Obtain dependencies and reverse dependencies of packages at a given depth of recursion

get_neighborhood(packages, level = 1L, relation = c("Depends", "Imports",
  "LinkingTo", "Suggests", "Enhances"), strict = FALSE, interconnect = TRUE,
  ignore = c("datasets", "utils", "grDevices", "graphics", "stats",
  "methods"))

Arguments

packages

(non-empty character vector) Package names

level

(positive integer, Default: 1L) Depth of recursive dependency

relation

(character vector) Types of relations. Must be a subset of c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances")

strict

(logical, Default: TRUE) Whether to consider all packages (alternately only 'relation' specific packages) when computing dependencies for the next level

interconnect

(flag, Default: TRUE) Whether to capture dependency among packages (of a given level) of the next level (See examples)

ignore

package names to ignore

Value

A tibble with three columns: `pkg_1`, `relation` and `pkg_2`

See also

neighborhood_graph, make_neighborhood_graph

Examples

# explore first level dependencies pkggraph::init(local = TRUE)
#> Using 'local' data ...
#> To fetch data from CRAN over internet, run:
#> `pkggraph::init(local = FALSE)`
#> Done!
pkggraph::get_neighborhood("caret")
#> Error in get_all_dependencies(packages = packages, level = level, relation = relation, strict = strict, ignore = ignore): Unable to find `deptable`. Please run `pkggraph::init(local = TRUE)`.
# explore second level dependencies pkggraph::get_neighborhood("caret", level = 2)
#> Error in get_all_dependencies(packages = packages, level = level, relation = relation, strict = strict, ignore = ignore): Unable to find `deptable`. Please run `pkggraph::init(local = TRUE)`.
# explore second level dependencies without # considering dependencies from third level pkggraph::get_neighborhood("caret", level = 2, interconnect = FALSE)
#> Error in get_all_dependencies(packages = packages, level = level, relation = relation, strict = strict, ignore = ignore): Unable to find `deptable`. Please run `pkggraph::init(local = TRUE)`.
# explore first level dependencies of multiple packages # and consider second level dependencies get_neighborhood(c("caret", "mlr"))
#> Error in get_all_dependencies(packages = packages, level = level, relation = relation, strict = strict, ignore = ignore): Unable to find `deptable`. Please run `pkggraph::init(local = TRUE)`.
# get 'imports' specific neighborhood of 'mlr' package with strict = TRUE get_neighborhood("mlr" , level = 2 , strict = TRUE , interconnect = FALSE , relation = "Imports")
#> Error in get_all_dependencies(packages = packages, level = level, relation = relation, strict = strict, ignore = ignore): Unable to find `deptable`. Please run `pkggraph::init(local = TRUE)`.
# get 'imports' specific neighborhood of 'mlr' package with strict = FALSE get_neighborhood("mlr" , level = 2 , strict = FALSE , interconnect = FALSE , relation = "Imports")
#> Error in get_all_dependencies(packages = packages, level = level, relation = relation, strict = strict, ignore = ignore): Unable to find `deptable`. Please run `pkggraph::init(local = TRUE)`.