Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Paste
P540
List R package versions
Active
Public
Actions
Authored by
ardumont
on Oct 6 2019, 11:49 AM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
Origin-CRAN
Subscribers
None
```
$ 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])
```
Event Timeline
ardumont
created this paste.
Oct 6 2019, 11:49 AM
2019-10-06 11:49:55 (UTC+2)
ardumont
mentioned this in
T2029: cran lister: Align lister to output list of tarballs per origin
.
Oct 6 2019, 12:08 PM
2019-10-06 12:08:33 (UTC+2)
ardumont
edited the content of this paste.
(Show Details)
Oct 7 2019, 10:28 AM
2019-10-07 10:28:01 (UTC+2)
Log In to Comment