Step 8: The sample package

To show you how this is done we have to create a sample package.  Before you jump to do that create   a new directory from your working directory. For this excercise I’ve created a new directory called “TestPackage”.  Start your R session and change your working directory to be the new directory you have created.

[1] "C:/Users/steve/Documents/TestPackage"

So, now that I’m in  my TestPackage directory, I’m going to create a test package. To do this we are going to use a tool called package.skeleton. At your prompt, enter ?package.skeleton(). read this help carefully as it explains what you will have to do in the future when you make your own packages.  Since I’m using RStudio I merely cut and past the example code into my console

## two functions and two "data sets" :
f <- function(x,y) x+y
g <- function(x,y) x-y
d <- data.frame(a=1, b=2)
e <- rnorm(1000)

package.skeleton(list=c("f","g","d","e"), name="mypkg")

And then I execute that code

And you should get the following message in your console

Creating directories ...
Creating DESCRIPTION ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Further steps are described in './mypkg/Read-and-delete-me'.

And you can check that the files were created. Here is what my system looks like now.

So following the instructions lets look at the Read-and-delete-me file. I just used RStudio to do that. And I get a look at the file

* Edit the help file skeletons in 'man', possibly combining help files for
  multiple functions.
* Put any C/C++/Fortran code in 'src'.
* If you have compiled code, add a .First.lib() function in 'R' to load the
  shared object.
* Run R CMD build to build the package tarball.
* Run R CMD check to check the package tarball.

Read "Writing R Extensions" for more information.

The instructions are pretty clear. I have to edit the manual files in order to build properly. On to step 9

  1. David Farrar
    December 19, 2012 at 9:16 PM

    Instructions above generated by package.skeleton() may not be entirely clear to all users who are not programmers, particularly that business about tarballs, not actually something the user necesarily wants. How about, “Taking things one step at a time we will next edit the manual files as instructed. The other instuctions will be covered at later steps.”

  2. July 2, 2013 at 3:36 AM

    They disassemble the application package to its
    lowest form (assembly). Either visually or with your hands, move all limiting energy off and into the sponge.
    It can be better to have a very bootable disc that may diagnose drive and memory problems
    and provide the Windows recovery environment to regenerate your backup for the same or a
    new hard drive.

  3. July 19, 2013 at 1:26 PM

    Yes, these musicians could be better off than you or I, nevertheless the fact in the matter is that when you steal music
    from and Psychopathic Records artist, they start cutting their staff, many of which are very important to their career’s progression. If not, then there should be an option to start downloading again. I try downloading’New Moon’ only to see if it’s
    up – but who am I kidding.

  4. February 11, 2014 at 2:35 AM

    I stumbled upon your blog while I was looking for cartilage earrings and I think that I am incredibly fortunate for
    doing this. I think that this is a extremely stunning blog you
    got there. Would it bother you if I post your blog on facebook including your url
    and the header of the page:”Step 8: Thee sample package “?

    Our Earrings for Cartilage Group

  5. abubakaryusuph
    September 28, 2015 at 2:27 PM

    it is a great lost for a country dat lost her brain drain

  1. June 9, 2011 at 12:20 AM

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: