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.