Download the latest version of pkgs by as_of_date to disk. Could take a while to run if input pkgs contains multiple packages.

download_pkgs(
  pkgs = PKG_GLOBAL_ENV$PA_PKGS,
  as_of_date = PKG_GLOBAL_ENV$PKG_FREEZE_DATE,
  path_to_dir = tempdir(check = TRUE),
  verbose = TRUE
)

Arguments

pkgs

character vector of the names of packages for which to query available versions

as_of_date

(character, convertible to date) date of interest to subset versions of pkgs

path_to_dir

(character, to be used as path to file system) path to file system where the downloaded packages will reside

verbose

(logical) whether to print verbose logs to console

Value

a list containing

  • path_to_dir: same as the input argument

  • pkg_dirs: names of package directories within path_to_dir

Examples

download_pkgs( pkgs = c("data.table", "knitr"), as_of_date = "2019-01-01", path_to_dir = tempdir(check = TRUE) )
#> Getting appropriate package versions...
#> Start to download packages data.table-1.11.8, knitr-1.21...
#> Downloading package data.table version 1.11.8 from https://mran.revolutionanalytics.com/snapshot/2019-12-30/src/contrib/data.table_1.11.8.tar.gz to /tmp/RtmpjwVHgv/data.table-1.11.8.tar.gz
#> Downloading package data.table version 1.11.8 from https://mran.revolutionanalytics.com/snapshot/2019-12-30/src/contrib/Archive/data.table/data.table_1.11.8.tar.gz to /tmp/RtmpjwVHgv/data.table-1.11.8.tar.gz
#> Unzipping package /tmp/RtmpjwVHgv/data.table-1.11.8.tar.gz in directory /tmp/RtmpjwVHgv
#> Downloading package knitr version 1.21 from https://mran.revolutionanalytics.com/snapshot/2019-12-30/src/contrib/knitr_1.21.tar.gz to /tmp/RtmpjwVHgv/knitr-1.21.tar.gz
#> Downloading package knitr version 1.21 from https://mran.revolutionanalytics.com/snapshot/2019-12-30/src/contrib/Archive/knitr/knitr_1.21.tar.gz to /tmp/RtmpjwVHgv/knitr-1.21.tar.gz
#> Unzipping package /tmp/RtmpjwVHgv/knitr-1.21.tar.gz in directory /tmp/RtmpjwVHgv
#> $path_to_dir #> [1] "/tmp/RtmpjwVHgv" #> #> $pkg_dirs #> [1] "data.table-1.11.8" "knitr-1.21" #>