Reputation: 1477
I am using a computer where I have read only rights for the R library folder. When I am installing new packages I therefore use
libpath <- "c:/R/mylibraries"
.libPaths( c( .libPaths(), libpath) )
install.packages("htmltools", lib=libpath)
always when I am installing a new packages with dependecies (like e.g. htmltools depends on lme4), I get erros like:
Error in .requirePackage(package) :
unable to find required package ‘lme4’
although lme4 is installed and I used it before.... also other errors/warnings like:
Warning in install.packages :
cannot remove prior installation of package ‘Rcpp’
or:
Warning in install.packages :
unable to move temporary installation ‘c:\...\file17b033a54a21\jsonlite’ to ‘c:\...\jsonlite’
occur. If I install them twice they usually work but sometimes dependencies to packages that worked before are lost and I have to reinstall them again. Is there a way to circumvent this?
Upvotes: 0
Views: 2808
Reputation: 57696
Put this in a file named .REnviron
in your Documents
folder and restart R:
R_LIBS=c:/R/mylibraries
From then on, you should be able to install packages into that location automatically, without having to fiddle around with .libPaths
.
Upvotes: 1