as_pkgrefs {rang}R Documentation

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

## Default S3 method:
as_pkgrefs(x, ...)

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

## S3 method for class '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())
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
}

[Package rang version 0.3.0 Index]