Skip to content
Prev 168183 / 398502 Next

.Renviron for multiple hardwares...

Jonathan Greenberg wrote:
You would certainly want to look at altering the library path on R 
startup using the RProfile.site file (see ?Startup). You R code could 
use bits of info from the R variables .Platform and .Machine, plus some 
environment variables for UNIX platform info.

As an example of altering the library path, this is what I have used in 
the past for my personal .Rprofile file:

### Add development R versions to the library path first
devlib <- paste('~/Rlib',gsub(' ','_',R.version.string),sep='/')
if (!file.exists(devlib))
         dir.create(devlib)

x <- .libPaths()
.libPaths(c(devlib,x))
rm(x,devlib)

So when I start up the latest development version of R, this is what is set:

$ /home/hornerj/R-sources/trunk/bin/R --quiet
 > .libPaths()
[1] 
"/home/hornerj/Rlib/R_version_2.9.0_Under_development_(unstable)_(2008-10-14_r46718)"
[2] "/home/hornerj/R-sources/trunk/library"

But with the latest ubuntu R release:

$ R --quiet
 > .libPaths()
[1] "/home/hornerj/Rlib/R_version_2.8.1_(2008-12-22)"
[2] "/usr/local/lib/R/site-library"
[3] "/usr/lib/R/site-library"
[4] "/usr/lib/R/library"

Jeff