Zelong
Zelong

Reputation: 2556

R .libPaths() automatically reset

OS: Mac OS X 10.10.3 R version: 3.2.0 (installed by Homebrew)

I want R to install packages in my home directory instead of the default "R_HOME", so I don't have to reinstall all packages after updating R.

I set the library path by .libPaths('~/Library/R/'). After that, all packages were installed in ~/Library/R. Checking by .libPaths()returned ~/Library/R and the R_HOME.

However, when I quit R (in RStudio or in terminal) and reopen R (in RStudio or terminal), .libPaths() only returned the R_HOME. I have to manually set .libPaths('~/Library/R/') again (the packages are still there).

Why does the library path automatically reset and how could I change it permanently?

Upvotes: 2

Views: 2387

Answers (1)

Gabi
Gabi

Reputation: 1343

I did something similar. Check your Sys.getenv(). Mine has 57 items. One of them is Sys.getenv()['R_LIBS']. I set it to "/Users/ghuiber/Rlibs" and it is persistent.

Upvotes: 2

Related Questions