Install multiple packages as they existed on CRAN at a specific date?

Viewed 113

Suppose someone wrote a script that worked wonderfully 5 years ago, but which doesn't work when packages are installed today (and assume the changes to some packages were very significant).

Is there any way to install CRAN packages by date. For example


install_CRAN_by_date("2016-05-01", c("rgdal", "sp", "dplyr", "trip"))

Is there any simple function that does this?

2 Answers

Use the checkpoint package and Microsoft's "CRAN Time Machine" that has daily snapshots of CRAN going back to 2014.

See this checkpoint vignette for examples. Essentially you'd do

library(checkpoint)
checkpoint("2015-01-01")
library(your_favorite_cran_package)

Suppose, the UI gives the correct release date ('input_date') of e.g. 'dplyr'. Get the 'version' based on the match between the 'input_date' and the 'version' column from available.versions and use that to install with install.versions

library(versions)
input_date <- "2019-06-29"
dplyr_versions <- available.versions('dplyr')$dplyr
vers <- dplyr_versions[match(input_date, dplyr_versions$version)]$version
install.versions('dplyr', vers)

With multiple packages, not sure all of them have the same release date or not. But, if they are, then use a loop with lapply

Related