Lately R version 4.1.0 was released on CRAN (see https://cran.r-project.org).
The MacOS version was one day late. But yesterday it was released, too. So I wanted to test the new version without being able to go back. “No problem”, I thought “I’m already using RSwitch”. RSwitch is a tiny Mac program which allows you to switch between installed R versions.
But unfornately RSwitch told me that R version 4.0.5 was incomplete after I’ve installed version 4.1.0.
What’s going on?
I took a look at
the different R versions are installed. And indeed in the directory
of the files and symbolic where missing.
I installed version 4.0.5 and the same happened to version 4.1.0 – but I could use version 4.0.5 again.
So I backed up the directory under
tar (you could also use
cp -a etc.), installed version 4.1.0 again and
restored my backup.
Now I can use both versions.
But there was still something odd. Using version 4.0.5 I used to install new
R-packages in my user-directory beneath
So I set up an anlogous directory
~/Library/R/4.1/library and was surprised
.libPaths() doesn’t show me this directory.
So I took a look at the global config-file at
The environment variable
R_LIBS_USER was set to
So I removed the
/x86_64 part and everythins was fine.
Transerfering Installed Packages
Next I wanted to transfer all my installed packages. So I exported a csv-file with all my installed packages using the old R-version running the following code
1 2 3 4 5 6
library(tidyverse) installed.packages() %>% as_tibble() %>% filter(!grepl("^/Library", LibPath)) %>% write_csv2(file = "packages.csv")
So I got a list of my installed packages. Some of these packages were installed only from local repositories so I removed them manually off the list.
The resulting huge list of package names was installed with