Is it possible to prevent R package conflicts while upgrading Ubuntu 16.04 LTS with R from CRAN to Ubuntu 18.04 LTS?
To run upgrade process from Ubuntu 16.04.7 LTS with R 3.4 from CRAN flawlessly one should do the following:
-
Backup a list of installed R packages
dpkg -l | grep "^ii r-" | awk '{print $2}' > ~/r-debs.txt
-
Remove CRAN
r-cran.list
APT sources file bysudo rm /etc/apt/sources.list.d/r-cran.list
-
Remove R packages
sudo apt-get autoremove $(cat r-debs.txt) --purge
-
Install R packages back using versions from official repositories
sudo apt-get install $(cat r-debs.txt)
-
Install possible updates
sudo apt-get update sudo apt-get dist-upgrade
then reboot.
-
Upgrade Ubuntu as usual using
sudo do-release-upgrade
orupdate-manager -c
. -
Upgrade RStudio using command below:
wget -c https://download1.rstudio.org/desktop/bionic/amd64/rstudio-1.4.1717-amd64.deb -O /tmp/rstudio.deb sudo apt-get install -y /tmp/rstudio.deb
The resulting Ubuntu 18.04.6 LTS system will have fully-functional R 3.4 from official repository.