Skip to contents

This function build a dependency tree for a provided list of packages. If some packages are required by the provided list but are not in the list, they are added.

Usage

repro_dependency_tree(
  wanted_packages = utils::installed.packages()[, "Package"],
  verbose = TRUE
)

Arguments

wanted_packages

CHARACTER : a list of installed packages (default to all packages installed)

verbose

LOGICAL : whether to print a progress bar or not (default to TRUE)

Value

This function returns a dataframe with two columns. The column "package" contains the name of the package. All wanted packages are there. The column "dependence" contains the dependency of the package.

Examples

if (FALSE) { # \dontrun{
wanted_packages = c("base", "Matrix", "ggplot")
relations = repro_dependency_tree(wanted_packages = wanted_packages_matrix)
g = igraph::graph_from_data_frame(relations)

custom = "Matrix"
custom_related = tools::package_dependencies(packages = custom,
                                             db = wanted_packages,
                                             recursive = TRUE,
                                             reverse = FALSE)
custom_related = c(as.character(unlist(custom_related)), custom)

sub = igraph::induced_subgraph(g, vids = custom_related, impl = "auto")
plot(sub)
} # }