Every time R
is upgraded, I have to reinstall the packages I use (from sources,so they have to be recompiled for the new version). This is a correct, understandable behavior, so I invoke install.packages
- and get an error because the user-writable directory "~/R/%p-library/%v"
does not exist yet and all the other directories in .libPaths()
are under /usr/
and are not user-writable. This behavior is documented in the referenced pages.
So, after getting the install error, I have to do this:
> dir.create(Sys.getenv("R_LIBS_USER"))
> .libPaths(Sys.getenv("R_LIBS_USER"))
> install.packages(c("igraph","entropy",...))
My question is: how do people deal with this issue?
Create the directory by hand after each upgrade? (but isn't that tedious?)
Add the dir.create
call to .Rprofile
? (apparently not)
EDIT: I seem to recall that, when I started to use R
, this library directory appeared without my action; but I might be wrong...
One thing you could try is specifying an R_LIBS
in a .REnviron
file in your $HOME$
directory, for instance I am on Windows at work so the first line in my .REnviron
is something like R_LIBS="C:\Some\path\library"
.
Then when you come to update from a major version change you can just use:
update.packages( lib.loc = .libPaths()[1] , checkBuilt = TRUE )
To find out your $HOME$
directory use:
Sys.getenv("HOME")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With