R & RStudio

Modified

2026-05-14

Note that the preferred way to install and manage R versions is through rig.

R with multi-version + binary package support

  • Config files (Renviron, Rprofile.site) go in e.g. /opt/R/4.0.2/lib/R/etc -> R version specific!

  • See bin/update-r-modules to create/update R modules and ensure all R versions use the same underlying configuration via a global Renviron.site and Rprofile.site (useful for CRAN mirror, other options)

  • For CRAN R builds, set the following in Rprofile.site to enable binary package support: options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version$platform, R.version$arch, R.version$os)))

  • /usr/local/bin/R is the global R version, symlinked to the default R version set by rig at /opt/R/current/bin/R -> if this is changed, this also affects RStudio Server!

  • Note that the P3M CRAN mirror for packages is Ubuntu version specific.

  • If you use pak for package installation, P3M binaries are used automatically, so that config is not specifically needed

RStudio Server

  • For installation and updating, see the download script at bin/rs-server-download.sh
  • Control server via sudo systemctl rstudio-server <command> or rstudio-server <command>
  • HTTP port changed to 443 for firewall reasons (only available port next to 22).