3

My problem:

> update.packages()
Warning: package 'nlme' in library 'C:/Program Files/R/R-3.3.0/library' will not be updated

This is well-known and is because writing to C:\Program Files\ needs Administrator (or at least elevated privileges).

I dislike the suggestions offered here, Unable to update R packages in default library on Windows 7, which are to either run R as an Administrator, or to give User-level permissions to write to C:\Program Files\R\library.

Question: I was wondering if I can simply move all the packages out of C:\Program Files\R\R-3.3.0\library\ into my (user-writable) directory, D:/My_Documents_VV/R/win-library/3.3? I'm worried about moving core packages such as boot and base.

(I realize that even if I could do it, it might cause a problem later when I upgrade R : there would be a clash between the new base and the one in my directory which I copy over to R/win-library/x.y/. I'm happy to take that risk / upgrade headache in this case)

> .libPaths()
[1] "D:/My_Documents_VV/R/win-library/3.3"
[2] "C:/Program Files/R/R-3.3.0/library"

COLOURS [19442] ~/ > ls -1 '/c/Program Files/R/R-3.3.0/library/'
base
boot
class
cluster
codetools
compiler
datasets
foreign
graphics
grDevices
grid
KernSmooth
lattice
MASS
Matrix
methods
mgcv
nlme
nnet
parallel
rpart
spatial
splines
stats
stats4
survival
tcltk
tools
translations
utils
Community
  • 1
  • 1
vijucat
  • 2,059
  • 1
  • 15
  • 17
  • 1
    Some are strong advocates of this, [see e.g., `installr::create.global.library`](http://www.inside-r.org/packages/cran/installr/docs/create.global.library). It can save you from needing to re-install every single package when you do a minor version bump in R. – Gregor Thomas May 26 '16 at 16:33
  • 2
    I wouldn't literally copy the files. But as mentioned above you can install packages in any non-default library location you like. – joran May 26 '16 at 16:52
  • 2
    Just copying the files will work in *most* cases, but then the cases that don't become unpleasant surprises down the road. You'll probably want to modify your `.Rprofile.site` file to add your global library to your library paths at start-up. – Gregor Thomas May 26 '16 at 17:02
  • @Gregor, thanks for the suggestion. I do use the `Renviron.site` file in the `$INSTALL_DIR/etc/` to add to `.libPaths()`. It's not exactly a "global" library, but version-specific (so that I can still use the old version of R + packages in case I need to reproduce some results) – vijucat May 27 '16 at 02:43

0 Answers0