| Title: | Explore the R Package Dependencies on the Comprehensive R Archive Network (CRAN) Like Repositories |
|---|---|
| Description: | Explore various dependencies of a packages (on the Comprehensive R Archive Network Like repositories). The functions get_neighborhood() and get_dependencies() provide dependencies of packages and as_graph() can be used to convert into a 'igraph' object for further analysis and plotting. |
| Authors: | Komala Sheshachala Srikanth [aut, cre], Singh Nikhil [aut] |
| Maintainer: | Komala Sheshachala Srikanth <[email protected]> |
| License: | GPL-3 |
| Version: | 0.3.1 |
| Built: | 2026-05-19 09:58:24 UTC |
| Source: | https://github.com/talegari/pkggraph |
Packages dependencies (typically obtained from
get_dependencies() or get_neighborhood()) is converted into a
igraph object.
as_graph(dependency_df)as_graph(dependency_df)
dependency_df |
( |
igraph object
## Not run: init() as_graph(get_neighborhood("mlr3")) ## End(Not run)## Not run: init() as_graph(get_neighborhood("mlr3")) ## End(Not run)
Get (reverse) dependencies of a set of packages till a certain
depth(level) for a set of dependency types (relation).
get_dependencies( packages, level = 1L, relation = c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances"), strict = FALSE, ignore = c("datasets", "utils", "grDevices", "graphics", "stats", "methods"), reverse = FALSE )get_dependencies( packages, level = 1L, relation = c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances"), strict = FALSE, ignore = c("datasets", "utils", "grDevices", "graphics", "stats", "methods"), reverse = FALSE )
packages |
( |
level |
( |
relation |
( |
strict |
( |
ignore |
( |
reverse |
( |
(dataframe) with three columns: pkg_1, relation and pkg_2
## Not run: init() get_dependencies("mlr3") |> get_dependencies("mlr3", level = 2) get_dependencies("mlr3", level = 2, reverse = TRUE) get_dependencies("mlr3", level = 2, relation = "Imports") # setting strict to TRUE to only consider 'Imports' of the previous level get_dependencies("mlr3", level = 2, relation = "Imports", strict = TRUE ) ## End(Not run)## Not run: init() get_dependencies("mlr3") |> get_dependencies("mlr3", level = 2) get_dependencies("mlr3", level = 2, reverse = TRUE) get_dependencies("mlr3", level = 2, relation = "Imports") # setting strict to TRUE to only consider 'Imports' of the previous level get_dependencies("mlr3", level = 2, relation = "Imports", strict = TRUE ) ## End(Not run)
Obtain dependencies and reverse dependencies of packages till a
given depth (level) for a set of dependency types (relation).
get_neighborhood( packages, level = 1L, relation = c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances"), strict = FALSE, ignore = c("datasets", "utils", "grDevices", "graphics", "stats", "methods") )get_neighborhood( packages, level = 1L, relation = c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances"), strict = FALSE, ignore = c("datasets", "utils", "grDevices", "graphics", "stats", "methods") )
packages |
( |
level |
( |
relation |
( |
strict |
( |
ignore |
( |
(dataframe) three columns: pkg_1, relation and pkg_2
## Not run: init() # explore first level dependencies get_neighborhood("mlr3") # explore second level dependencies get_neighborhood("caret", level = 2) # explore first level dependencies of multiple packages # and consider second level dependencies get_neighborhood(c("caret", "mlr")) # get 'imports' specific neighborhood of 'mlr' get_neighborhood("mlr", relation = "Imports") ## End(Not run)## Not run: init() # explore first level dependencies get_neighborhood("mlr3") # explore second level dependencies get_neighborhood("caret", level = 2) # explore first level dependencies of multiple packages # and consider second level dependencies get_neighborhood(c("caret", "mlr")) # get 'imports' specific neighborhood of 'mlr' get_neighborhood("mlr", relation = "Imports") ## End(Not run)
Initiate the package by loading the data into parent frame. This
should be done as soon as the package is loaded or attached. This
creates(rewrites) new variables deptable and packmeta to the
environment where it is run from.
init(repository = "CRAN", ...)init(repository = "CRAN", ...)
repository |
( |
... |
Parameters to be passed to |
Format of packmeta: A dataframe with one row per package with some
metadata.
Format of deptable: Dataframe with three columns pkg_1 (chr), relation
(factor, levels = Depends, Imports, Suggests, LinkingTo,
Enhances), pkg_2 (chr)
TRUE (invisibly)
Plot of packages dependencies or neighborhood with edges colored
by relation and node sized by 'centrality' from a neighborhood_graph
obtained from as_graph.
## S3 method for class 'neighborhood_graph' plot(x, layout = "sugiyama", ...)## S3 method for class 'neighborhood_graph' plot(x, layout = "sugiyama", ...)
x |
neighborhood_graph |
layout |
layout is passed to ggraph::ggraph |
... |
Not used |
ggraph plot
## Not run: init() get_neighborhood("mboost") |> as_graph() |> plot() ## End(Not run)## Not run: init() get_neighborhood("mboost") |> as_graph() |> plot() ## End(Not run)