I'm trying to work out why my .libPath
is different between command-line R and RStudio Desktop (NOTE: this is not a duplicate of this question as that fix involved stuff specific to RStudio Server which I don't have).
When I use R on the command-line (linux):
> .libPaths()
[1] "/home/mathematicalcoffee/R/library" "/usr/local/lib/R/site-library"
[3] "/usr/lib/R/site-library" "/usr/lib/R/library"
When I use RStudio Desktop (linux, same machine):
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library" "/usr/lib/R/library" "/usr/lib/rstudio/R/library"
Now I have set $R_LIBS_USER
to ~/R/library
in my bash profile, so R-command-line picks it up as my preferred libPath.
The problem is in RStudio Desktop when I do:
Sys.getenv('R_LIBS_USER')
# "~/R/x86_64-pc-linux-gnu-library/2.15"
So why has RStudio Desktop changed my R_LIBS_USER
? How can I change it back?
(I don't use an .Rprofile file). (In the question I linked above the solution for RStudio Server was to modify /etc/rstudio/rsession.conf
, but I don't have that as I've got RStudio Desktop. Also, I believe RStudio should be respecting my R_LIBS_USER
environment variable.)