get_network: flowchart of R projects

View source: R/get_network.R

get_networkR Documentation

flowchart of R projects

Description

With this function a network plot of the connections of the functions in a given path can be created.

Usage

get_network(
  dir = NULL,
  variations = c("<- function", " <- function", "<-function", " <-function"),
  pattern = "\\.R$",
  simplify = FALSE,
  all_scripts = NULL,
  use_internals = TRUE,
  exclude = NULL,
  verbose = FALSE
)

Arguments

dir

a path that includes the functions

variations

a character vector with the function's definition string. The default is c(" <- function", "<- function", "<-function").

pattern

a string with the file suffix - default is "\.R$".

simplify

a boolean, if TRUE function with no connections are removed from the plot.

all_scripts

a named list with script. The given path is dominant. This is mainly used for debugging purposes.

use_internals

a boolean, if FALSE than only functions that are also a file's name are used. This should respond to internal functions. The default is TRUE.

exclude

a vector with folder's or function's names, that are excluded from the network creation. This is done by a regex, so it will remove everything that contains these words.

verbose

a boolean setting the debugging prints.

Value

Returns an object with the adjacency matrix $matrix, an igraph object $igraph, a table for the edges $edge_dt, a table for the nodes $node_dt and a networkD3 plot $networkD3.

Note

TODO: list with exclude files and comments ' ' in one line

TODO: maybe return plot

Author(s)

Jakob Gepp

See Also

For more information check out our blog. Also there is a README on how to use this function here.

Examples

## Not run: 
net <- get_network(dir = "R/", simplify = TRUE)
g1 <- net$igraph
plot(g1)

## End(Not run)


STATWORX/helfRlein documentation built on Feb. 12, 2024, 2:21 a.m.