getDependsThread

0th

Percentile

Compute which code blocks in a script are inputs to define a variable

This function is used to determine which code blocks in an R "script" that are needed to define a particular variable. This finds the smallest complete set of expressions or code blocks that must be evaluated in order to define the specified variable(s). It omits expressions that do not provide outputs that are not used as inputs to (indirectly) define the speciied variable.

Keywords
programming
Usage
getDependsThread(var, info, reverse = TRUE)
Arguments
var

the name of a variable in the script

info

a list of the meta-information for each of the code elements in the script.

reverse

a logical value that determines whether we reverse the indices of the expressions or leave them as end-to-first.

Value

An integer vector giving the indices of the script code blocks which are required to define var.

See Also

getExpressionThread readScript getVariables

Aliases
  • getDependsThread
  • getDependsThread,character-method
  • getDependsThread,name-method
  • getDependsThread,numeric-method
Examples
# NOT RUN {
 sc = readScript(system.file("samples", "dual.R", package =
"CodeDepends"))
sci = getInputs(sc, formulaInputs = TRUE) ## script has formula with no data.frame
 idx = getDependsThread("fit", sci)
# }
Documentation reproduced from package CodeDepends, version 0.6.5, License: GPL

Community examples

Looks like there are no examples yet.