Skip to contents

This function exports the results from resolve() to an installation script that can be run in a fresh R environment.

Usage

export_rang(
  rang,
  path,
  rang_as_comment = TRUE,
  verbose = TRUE,
  lib = NA,
  cran_mirror = "https://cran.r-project.org/",
  check_cran_mirror = TRUE,
  bioc_mirror = "https://bioconductor.org/packages/"
)

Arguments

rang

output from resolve()

path

character, path of the exported installation script

rang_as_comment

logical, whether to write resolved result and the steps to reproduce the file to path as comment

verbose

logical, pass to install.packages(), the negated value is also passed as quiet to both install.packages() and download.file().

lib

character, pass to install.packages(). By default, it is NA (to install the packages to the default location)

cran_mirror

character, which CRAN mirror to use

check_cran_mirror

logical, whether to check the CRAN mirror

bioc_mirror

character, which Bioconductor mirror to use

Value

path, invisibly

Details

The idea behind this is to determine the installation order of R packages locally. Then, the installation script can be deployed to another fresh R session to install R packages. dockerize() and apptainerize() are more reasonable ways because a fresh R session with all system requirements is provided.

References

Ripley, B. (2005) Packages and their Management in R 2.1.0. R News, 5(1):8--11.

Examples

# \donttest{
if (interactive()) {
    graph <- resolve(pkgs = c("openNLP", "LDAvis", "topicmodels", "quanteda"),
                    snapshot_date = "2020-01-16")
    export_rang(graph, "rang.R")
}
# }