getfunmap: getfunmap generates node and edge data to map function...

View source: R/rutils.R

getfunmapR Documentation

getfunmap generates node and edge data to map function relationships

Description

getfunmap takes in a directory of R files,and optionally a vector of filenames within which to search for functions and any calling relationships between them. It generates a 2-column matrix of edges between nodes ready for use by the graph_from_edgelist function from igraph. It identifies those functions that call other functions within the same R package, and maps only those. It also identifies those functions that are isolated and are only called from outside the package. Mapping all functions inside a larger package can lead to a complex visual mess of a map, hence the option of examining the relationships between a smaller given set of functions is provided with the checkfun argument. This is designed so that people may illustrate the design of their own R packages but can be used with any collection of R functions.

Usage

getfunmap(indir, checkfun = "", sortby = "function", files = "", outfile = "")

Arguments

indir

the directory containing R files for analysis

checkfun

a vector of functions whose relationships are to be mapped. If left as the default = ”, then all functions are mapped.

sortby

How should the functions object produced by describefunctions be sorted? Options are 'Rfile', function', 'calls', 'called-by', and even 'syntax' though that would be messy.

files

default = ”, but could be a list of R files to be found in indir that should be analysed, if left at default all R files will be used

outfile

the names of a txtfile (.csv spearated) to store the output from describefunctions, again default = ”, no file saved.

Value

a list of alledges, function matrix, the checkfun used, all edges, and a vector of the names of any isolated functions

See Also

describefunctions

Examples

print("wait on suitable example data")
# indir=rundir; checkfun=checkvar;sortby="function";files="";outfile=""

haddonm/codeutils documentation built on April 5, 2025, 11:29 p.m.