Learn R Programming

rang (version 0.3.0)

as_pkgrefs: Convert Data Structures into Package References

Description

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, ...)

Value

a vector of package references

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

Examples

Run this code
as_pkgrefs(sessionInfo())
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
}

Run the code above in your browser using DataLab