make_cran: Making networks of inter- and intra-package dependencies

make_cranR Documentation

Making networks of inter- and intra-package dependencies

Description

These functions read information from CRAN or within an R package's working directory to create a networks of a package's dependencies:

  • read_cran() creates a network of a package's dependencies on other packages available on CRAN. It looks for the Depends, Imports and Suggests fields in the package's DESCRIPTION file and creates a network where nodes are packages and ties are dependencies.

  • read_pkg() creates a network of function dependencies from R scripts in a directory. It looks for function definitions and function calls within the scripts and creates a network where nodes are functions and edges are function calls. It can also include function calls to functions not defined within the scripts.

Usage

read_cran(pkg = "all")

read_pkg(dir = getwd())

Arguments

pkg

The name

dir

Character string or vector of character strings with the directory or directories to search for R scripts. If NULL (the default), the current working directory is used.

Details

Note that these functions are not as actively maintained as others in the package, so please let us know if any are not currently working for you or if there are missing import routines by raising an issue on Github.

Value

A tidygraph object representing the network of package dependencies or function dependencies in a package.

Author(s)

Jakob Gepp

Source

https://www.r-bloggers.com/2016/01/r-graph-objects-igraph-vs-network/

https://github.com/STATWORX/helfRlein/blob/master/R/get_network.R

See Also

as

Other makes: make_create, make_ego, make_explicit, make_learning, make_motifs, make_play, make_random, make_read, make_stochastic, make_write

Examples

# mnet <- read_cran()
# mnet <- to_ego(mnet, "manynet", max_dist = 2)
# mnet <- read_pkg()

manynet documentation built on Nov. 5, 2025, 6:26 p.m.