reformat_db: Format the package database

View source: R/db.R

reformat_dbR Documentation

Format the package database

Description

Format the package database

Usage

reformat_db(db, version = NULL)

Arguments

db

A data frame returned from available.packages or installed.packages.

version

Version of the database, a self-defined text.

Details

It reformats the data frame of the package database into a pkg_db class object.

Value

A pkg_db class object. There are the following methods:

pkg_db$get_meta(package,field=NULL)

field can take values in "Package", "Version" and "Repository".

pkg_db$get_dependency_table(package)

Get the dependency table.

pkg_db$get_rev_dependency_table(package)

Get the reverse dependency table.

pkg_db$package_dependencies(package,recursive=FALSE,reverse=FALSE,which="strong",simplify=FALSE)

All the arguments are the same as in package_dependencies. Argument simplify controls whether to return a data frame or a simplied vector.

Examples

## Not run: 
db = available.packages()
db2 = reformat_db(db)

# a pkg_db object generated on 2021-10-28 can be loaded by load_pkg_db()
db2 = load_pkg_db(online = FALSE)
db2
db2$get_meta("ComplexHeatmap")
db2$get_dependency_table("ComplexHeatmap")
db2$get_rev_dependency_table("ComplexHeatmap")
db2$package_dependencies("ComplexHeatmap")
db2$package_dependencies("ComplexHeatmap", recursive = TRUE)

## End(Not run)

jokergoo/pkgndep documentation built on Aug. 15, 2023, 4:13 a.m.