R package installations

To see the directories that R searches for libraries, from within R you can do:

.libPaths();

To install a package to user specified directory, do

export R_LIBS="/home/your_username/R_libs"

Then either from within R, do

install.packages('package_name', repos="http://cran.r-project.org")

Or download the tarbar and install it directly from the command line

R CMD INSTALL -l /home/your_username/R_libs pkg_version.tar.gz

A handy repo to use

install.packages("package_name",repos="http://cran.cnr.berkeley.edu")

To permanently change to the repo address, do

echo "options(repos = c(CRAN = "https://cran.revolutionanalytics.com"))" > ~/.Rprofile

Updated: