Crt Crt - 1 year ago 140
R Question

.libPaths() not changing

I have set R_LIBS in my .bash_profile to

export R_LIBS=/lib/R-3.3.0

and when I
echo $R_LIBS
, it returns
but, when I start R and type
I get

What is going wrong?


Answer Source

You want R_LIBS_USER:

$ Rscript -e 'print(.libPaths())'
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"   
[3]            "/usr/lib/R/library"           
$ R_LIBS_USER="/tmp" Rscript -e 'print(.libPaths())'
[1]                    "/tmp"  "/usr/local/lib/R/site-library" 
[3] "/usr/lib/R/site-library"             "/usr/lib/R/library" 

We see that adding one value to R_LIBS_USER adds a fourth directory to the three I get by default on my system.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download