Help @ MC
The [R] environment
Help @ MC Logo
Centre for Mathematical Sciences, Lund University
    Print this page!
Home

Up to Help

Docs
R Help

Packages
CRAN
R.oo
aroma

Install
The R software
Most packages

Tips'n'Tricks
install.packages
Rgui (Windows)

External Links
R homepage
Download R
bioconductor.org
braju.com packages



Printer-friendly
Print this page



Powered by Google

install.packages()

Henrik Bengtsson, November 27, 2003.

Introduction

A much more user-friendly way of installing packages than to ask the user to download the correct binary or source distribution, save it at a appropriate location and the run R CMD install <pkg> is to provide installation through install.packages("<pkg>", contrib.url="<url>"). This is how packages on CRAN can be installed. Updates are done by a call to update.packages(contrib.url="<url>").

Requirements

To provide a install.packages() installation interface, you need to

  1. Decide on a URL (contrib.url) where the packages and bundles should be installed from.
  2. At this URL, put a PACKAGES file of the correct format.
  3. Put all *.tar.gz (source) and *.zip (Windows binary) distributions of your packages and bundles (as listed in the PACKAGE file) at this URL.

About the format of PACKAGES file: I do not know of any documentation of the format, but it is basically a strip down version of each DESCRIPTION file. The example file below is pretty self-explanatory. See also the PACKAGES file at CRAN. Find the URL for it by contrib.url(getOption("CRAN")) in R.

Example

To download and install the R.classes bundle you just have to write

install.packages("R.classes", 
                 contrib.url="http://www.maths.lth.se/help/R/")

in R. For this to work I have done the following

  1. The URL (contrib.url) where the packages should be installed from is http://www.maths.lth.se/help/R/.
  2. The PACKAGES file is placed at this URL,
  3. together with all the package files.