R: Creating a local library

From MathWiki

Table of contents

Creating a local R library (package)

Incomplete

References

http://faculty.chicagogsb.edu/peter.rossi/research/bayes%20book/bayesm/Making%20R%20Packages%20Under%20Windows.pdf
http://www.maths.bris.ac.uk/~maman/computerstuff/Rhelp/Rpackages.html
http://www.stat.berkeley.edu/~sandrine/Docs/Talks/MBI04/Lects/lectLab1BioCRIntro.pdf
R documentation using 'help.start()':
Writing R Extensions
R Installation and administration
 ?package.skeleton

Steps

Install required software

Under Windows, I use Cygwin to have a shell. One needs to use ActivePerl instead of the version that comes with Cygwin. Also one needs to make sure that 'make' is installed with Cygwin.
Make sure the PATH variable is set to include the bin directory of the latest R release:
Under Windows XP: Right-click on 'My Computer'; Click on 'Properties'; Click on 'Advanced'; Click on 'Environment Variables'; Edit the 'Path' variable to include ...

Create initial data structure

1. In R, load functions for library and create skeleton directory structure with
 > package.skeleton( name = "ym" )
2. ....

Install for local use

Using Cygwin or another shell:
cd to the directory that contains the directory for the library (say it's called 'ym')
Use the command: Rcmd INSTALL ym

Creating a publicly accessible repository

Create a directory, e.g. 'R', in a directory that is accessible on the internet (e.g. the directory containing your home page)

Install to repository

Install from repository

Advanced

Use bioconductor tools for package maintenance, etc.

How to access a repository: http://www.maths.lth.se/help/R/.R/library/reposTools/doc/reposClient.pdf
How to set up a repository: http://www.maths.lth.se/help/R/.R/library/reposTools/doc/reposServer.pdf