How to install R packages on Unix


First download the contributed R package source files extension .tar.gz from the CRAN web site to a new directory and then execute the following command:

        mkdir -p ~/.R/libs/

To inform R where to look for the libraries that you installed you should create a file called .Renviron in your home directory containing the line:

        R_LIBS=~/.R/libs/

This can be done using the following command:

        echo 'R_LIBS=~/.R/libs/' >> ~/.Renviron

This sets the environment variable R_LIBS whenever you start R and adds the path to the list of paths visible by the R command .libPaths() that can be executed when inside R.

 

Installing NetCDF:

Note: It may be necessary to download the NetCDF source from the following website: ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.gz in order to install packages "ncdf" and "RNetCDF".


Extract the netcdf.tar.gz file into your home directory:

          tar -zxvf netcdf.tar.gz

Then compile NetCDF:

          cd netcdf-*

          ./configure --prefix=$HOME/netcdf

          make install   

          make check


To install packages execute the commands in install_packages_unix.txt.

To use the packages start R and type the commands found in library_unix.txt.

 

Comment Comment on this page.

If you would like to comment on this particular web page or on our website in general, we would be pleased to receive your views via the box below:

Your Name :
Your Email Address :
Comments/Feedback :

valid xhtml valid_css2 valid_firefoxie