Usage examples for rcli
Usage: rcli [-h] [-v] [subcommand] <R version> [--arch ARCHITECTURE] [--force]
install Install an R version
switch Switch between installed R versions
list/ls List installed R versions or user libraries (r_versions | user_libs)
remove Remove an installed R version
rcli install devel
rcli install 4.1.1
rcli install 4.1.0 --arch x86_64
rcli install 4.0.5 --force
rcli switch 4.1.1 --arch x86_64
Once a year a new R minor version is released which requires the reinstallation of packages as the library path changes.
While there is no dedicated subcommand in
rcliavailable (yet) to help with this task, here's a code snippet to do this "manually". Note that this snippets references library paths from a macOS arm64 machine. If you use a different one, you need to adjust the library paths accordingly!
Also the following assumes that you have already installed the new R version and use it as your active one.
rcli install rel # assuming 'rel' is R 4.2.0
lib_loc <- "~/Library/R/arm64/4.1/library/"
to_install <- unname(installed.packages(lib.loc = lib_loc)[, "Package"])
Note: This will only successfully reinstall packages available on CRAN. GitHub-only packages and local packages will fail.