packgraph

R build status Travis build status Project Status: Concept

Examine and analyse static function call graphs of R packages. Mostly derived from functionality provided by the r-lib/pkgapi package, which is not on CRAN and must first be installed with

remotes::install_github ("r-lib/pkgapi")

The main function, pg_graph(), returns all exported and non-exported functions from a package (as nodes), and tallies of all functional connections between these (as edges). The function also includes a plot parameter which can be used to visualize the resultant network using the visNetwork package.

library (packgraph)
if (!file.exists ("./git2r"))
    git2r::clone ("https://github.com/ropensci/git2r", local_path = "./git2r")
# Currently needs absolute file paths to work
pkg_dir <- tools::file_path_as_absolute ("./git2r")
g <- pg_graph (pkg_dir, plot = FALSE)
g

prior art



mpadge/packgraph documentation built on May 10, 2022, 2:27 p.m.