Alex Rivera | Logout

R .libPaths() difference between RStudio and command-line R

Asked 2011-08-20T02:22:09.190
9

When I run R from the command line:

> library(ggplot2)
...
> path.package('ggplot2')
[1] "/home/yang/R/x86_64-pc-linux-gnu-library/2.13/ggplot2"
> .libPaths()
[1] "/home/yang/R/x86_64-pc-linux-gnu-library/2.13"
[2] "/usr/local/lib/R/site-library"                
[3] "/usr/lib/R/site-library"                      
[4] "/usr/lib/R/library"                           
> Sys.getenv('R_LIBS_USER')
[1] "~/R/x86_64-pc-linux-gnu-library/2.13"

(Note: that environment variable actually doesn't exist when I check from my shell.)

But from RStudio Server running on the same box, and after logging in as the same user:

> path.package('ggplot2')
[1] "/home/yang/R/library/ggplot2"
> .libPaths()
[1] "/home/yang/R/library"              "/usr/local/lib/R/site-library"    
[3] "/usr/lib/R/site-library"           "/usr/lib/R/library"               
[5] "/usr/lib/rstudio-server/R/library"
> Sys.getenv('R_LIBS_USER')
[1] "/home/yang/R/library"

Can you explain why these are different by default? Is this an RStudio customization? (Why?) Thanks in advance.

Edit
Report

1 Answer

7

A quick googling got me here:

http://support.rstudio.org/help/discussions/problems/868-how-to-configure-libpaths

so it looks like RStudio uses its own libs, set in /etc/rstudio/rsession.conf. Why? Who knows.

answered 2011-08-20T14:51:38.280

Your Answer