Home > Uncategorized > Making Simple Packages in R on Windows

Making Simple Packages in R on Windows

There are any number of short tutorials on making add on R packages on your Windows machine. This is yet another version of that process. I’ve explained what I did in 10 easy steps on the pages, but I’ll give a brief overview here.

In the first step I spent some time updating my R environment. For me that means getting  the latest copy of R ( 2.13.0) and checking that my RStudio is updated as well. RStudio is a great tool. In the future I hope that they can simplify the process of making R packages. The next step I suggest is getting a little familiar with your Windows system.  In step 2 we look at the Command Prompt and the PATH variable. We also take note of where our R binaries are installed. The reason is this. In order to build a package you use the command prompt and you issue R CMD commands. That means your path has to be aware of  where your R is located. That entails editing your PATH variable. For me that was ancient history. For this exercise I’ve decided to use pure R.  In the next steps we download and install the tools we need to build packages. For this tutorial the source files are PURE R, so there is no need for compiler for other languages. In the future I’ll try that. After we install the tools we have to do some editing of the PATH variable. This is where 50% of your problems will occur, so spent some time understanding that part of the process. After we edit the path we reboot.

The next phase of our process involves writing a sample package. For this step I merely use the example code provided by the function package.skeleton().  After we execute that function we come to the second hardest part of the job. editing help files. Looking at comments people make this step also causes problems. The documentation on editing these files is  rather daunting. If I had to pick one piece of R that could use a more detailed manual and editing tools ( with a built in checker) it would be this.

 

After we edit the files we can then build the package, check the package, and install the package.

 

Enjoy

About these ads
Categories: Uncategorized
  1. RomanM
    June 9, 2011 at 1:36 AM

    Steven, you might be interested in what I ran across today in this regard:

    https://github.com/hadley/devtools/wiki/

    The same person also has a list of of 300 R functions everyone should know:

    https://github.com/hadley/devtools/wiki/vocabulary

    github seems to be a programming sharing site which could be of use when co-writing programs.

    • steven mosher
      June 9, 2011 at 9:06 AM

      what I meant to say is that I’ve had my git for a a few weeks.

  2. steven mosher
    June 9, 2011 at 8:05 AM

    Thanks Roman I have my git account all set up. i’m waiting for the RStudio guys to integrate source control into their package so its seemless. SVN on RForge is another idea.

    I Met Hadley on Monday. He is a very kool guy. Wicked smart and a great programmer.

  3. Anonymous
    June 9, 2011 at 8:49 AM

    The RStudio guys already use version control.

    https://github.com/rstudio/rstudio

    • steven mosher
      June 9, 2011 at 9:04 AM

      No, I’m talking about INTEGRATED version control WITHIN the application… I know they use git. Anyway, I went to a talk they gave and the next big features will be debug, version control and tools for building packages.. Not sure what to expect for the latter.. maybe something based on roxygen.. not sure Ill drop them a line.

  4. June 19, 2013 at 8:12 PM

    Hello There. I found your blog using msn. This is an extremely
    well written article. I will be sure to bookmark it and
    return to read more of your useful information. Thanks for the
    post. I will definitely comeback.

  1. No trackbacks yet.

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 39 other followers

%d bloggers like this: