Update R Packages
To update packages to their latest CRAN version, run the following lines of code:
pkgs <- c("data.table", "dplyr") for (pkg in pkgs) install.packages(pkg, repos = "https://cloud.r-project.org")
If you need a package in a specific version, there are different methods, such as the renv
package.
Here is a lightweight alternative to use on Saagie:
options(repos = "https://cloud.r-project.org") if (!length(find.package("remotes", quiet = TRUE))) install.packages("remotes") versions <- c(data.table = "1.10.0", dplyr = "0.5.0") for (pkg in names(versions)) if (!length(find.package(pkg, quiet = TRUE)) || packageVersion(pkg) != versions[pkg]) remotes::install_version(pkg, versions[pkg])