Skip to content

Instantly share code, notes, and snippets.

@arraytools
Created December 30, 2023 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arraytools/83c8aade68f44b42557d6f1afbb906a2 to your computer and use it in GitHub Desktop.
Save arraytools/83c8aade68f44b42557d6f1afbb906a2 to your computer and use it in GitHub Desktop.
Install multiple versions of R and launch RStudio with different versions of R. Here I assume I'm working on a Debian desktop (Linux distro affects how R is installed and the binary version of RStudio.
# References:
# https://cran.r-project.org/bin/linux/debian/
# https://rviews.rstudio.com/2018/03/21/multiple-versions-of-r/
# 2023/12/30
sudo nano /etc/apt/sources.list # deb-src http://deb.debian.org/debian/ unstable main
sudo apt update
sudo apt build-dep r-base
wget https://cran.r-project.org/src/base/R-4/R-4.3.2.tar.gz
tar -xzvf R-4.3.2.tar.gz
cd R-4.3.2
./configure --prefix=/opt/R/$(cat VERSION) --enable-R-shlib --with-blas --with-lapack
make -j2
sudo make install
wget https://cran.r-project.org/src/base/R-4/R-4.2.3.tar.gz
tar -xzvf R-4.2.3.tar.gz
cd R-4.2.3
./configure --prefix=/opt/R/$(cat VERSION) --enable-R-shlib --with-blas --with-lapack
make -j2
sudo make install
# I am on Debian 12, so download Debian 12 version of RStudio
sudo apt install ./Downloads/rstudio-2023.12.0-369-amd64.deb
env RSTUDIO_WHICH_R=/opt/R/4.3.2/bin/R rstudio &
env RSTUDIO_WHICH_R=/opt/R/4.2.3/bin/R rstudio &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment