I updated my Ubuntu 16.04 machine to R 3.4.1. When installing the first non-required package (eg, lubridate), I received the message:
would you like to create a personal library 'null' to install packages into?
This occurred in both RStudio and the command-line R. I uninstalled r-base-core
& reinstalled r-base
and r-base-dev
through apt-get, and still had problems.
I noticed that the /etc/R/
directory contained four fleeting files that existed temporarily during the installation process, but had vanished by the time apt-get install r-base r-base-dev
completed. I reinstalled again to quickly grab and paste those files to the desktop. After re-installing again, I copied them into /etc/R/
with:
~/Desktop/temp$ sudo cp repositories.dpkg-new /etc/R/repositories
~/Desktop/temp$ sudo cp Rprofile.site.dpkg-new /etc/R/Rprofile.site
~/Desktop/temp$ sudo cp ldpaths.dpkg-new /etc/R/ldpaths
~/Desktop/temp$ sudo cp Makeconf.dpkg-new /etc/R/Makeconf
The second step was to uncomment the second like below, found in /etc/R/Renviron
. Apparently this is a recent change in the r-base packaging by @dirk-eddelbuettel.
# edd Jun 2017 Comment-out R_LIBS_USER
#R_LIBS_USER=${R_LIBS_USER-'~/R/x86_64-pc-linux-gnu-library/3.4'}
##R_LIBS_USER=${R_LIBS_USER-'~/Library/R/3.4/library'}
I have a two-part question:
You are close. The problem rests in the "commenting out" of those lines, made without checking compatibility. The same problem happens if you try to install a library manually within the REPL, eg using:
install.packages("survival")
With the difference that you get an "NA" error instead of "null".
Solution for future R upgrades, if you want minimal hassle:
Restore the /etc/R/Renviron to the package default, so that it won't ask for your input (or just be overwritten) next time R is upgraded
Add a Renviron in your home directory, eg $HOME/.Renviron
, with the following content:
R_LIBS_USER="${HOME}/R/${R_PLATFORM}-library/3.4.1/"
Personally, each time R upgrades I reinstall all libraries with the new version. So I will modify that 3.4.1
with 3.4.2
or whatever new version I have, and then reinstall the libraries.
If you don't want to reinstall your libraries, you can try to remove the version subdirectory altogether, eg:
R_LIBS_USER="${HOME}/R/${R_PLATFORM}-library/
so that your old libraries will be immediately seen by R.
NB: I couldn't find a way to put the R version inside the Renviron, sadly, but this could be achieved using an .Rprofile instead (since that can contain R code).
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