``` $ sudo apt install r-base ``` ``` #!/usr/bin/Rscript --vanilla # This R script: # - calls the builtin API to install the versions package # if not already installed. # - then triggers a version check on the package passed as # argument to this script. args = commandArgs(trailingOnly=TRUE) if (length(args)==0) { stop("Must supplied one argument (package version to list version from).n", call.=FALSE) } # install idempotently an R pkg (no debian package for it yet) pkgLoad <- function(pkg) { if (!require(pkg, character.only = TRUE)) { install.packages(pkg, dep=TRUE) if(!require(pkg, character.only = TRUE)) stop("Package not found") } suppressPackageStartupMessages(library(pkg, character.only = TRUE)) } pkgLoad('versions') versions::available.versions(args[1]) ```