Skip to contents

This generic function converts several standard data structures into a vector of package references, which in turn can be used as the first argument of the function resolve(). This function guessimates the possible sources of the packages. But we strongly recommend manually reviewing the detected packages before using them for resolve().

Usage

as_pkgrefs(x, ...)

# S3 method for default
as_pkgrefs(x, ...)

# S3 method for character
as_pkgrefs(x, bioc_version = NULL, no_enhances = TRUE, no_suggests = TRUE, ...)

# S3 method for sessionInfo
as_pkgrefs(x, ...)

Arguments

x,

currently supported data structure(s) are: output from sessionInfo(), a character vector of package names

...,

not used

bioc_version

character. When x is a character vector, version of Bioconductor to search for package names. NULL indicates not search for Bioconductor.

no_enhances

logical, when parsing DESCRIPTION, whether to ignore packages in the "Enhances" field

no_suggests

logical, when parsing DESCRIPTION, whether to ignore packages in the "Suggests" field

Value

a vector of package references

Examples

as_pkgrefs(sessionInfo())
#> [1] "cran::rang"
if (interactive()) {
   require(rang)
   graph <- resolve(as_pkgrefs(sessionInfo()))
   as_pkgrefs(c("rtoot"))
   as_pkgrefs(c("rtoot", "S4Vectors")) ## this gives cran::S4Vectors and is not correct.
   as_pkgrefs(c("rtoot", "S4Vectors"), bioc_version = "3.3") ## This gives bioc::S4Vectors
}