getVariableDepends {CodeDepends} | R Documentation |
Determine dependencies for code blocks
Description
These functions provide ways to determine which code blocks
must be evaluated before others based on input and output variables.
getVariableDepends
is used to determine the code blocks
that need to be run in order to define particlar variables.
getSectionDepends
Usage
getVariableDepends(vars, frags, info = lapply(frags, getInputs, ...),
checkLibraries = FALSE, asIndex = FALSE, functions = TRUE, ...)
getSectionDepends(sect, frags, info = lapply(frags, getInputs, ...), index =
FALSE, ...)
Arguments
vars |
the names of the variables of interest |
frags |
the blocks or groups of expressions from the document |
info |
the information about the fragments that identify the inputs. This is typically computed as the default value for the parameter but can be provided explicitly when the caller has alreay computed this and passes it to different functions. |
index |
a logical value that controls whether we return the
indices of the fragments of interest ( |
sect |
the index of the section/fragment to be analyzed |
checkLibraries |
a logical value |
asIndex |
a logical value that controls whether we return the expressions/code blocks or their indices. |
functions |
passed to |
... |
passed to |
Value
getVariableDepends
returns a Script-class
object
consisting of the subset of code blocks relevant to the specified variables.
If asIndex
is TRUE
, getVariableDepends
returns the indices of the
code blocks in the original script.
Author(s)
Duncan Temple Lang
See Also
getPropagateChanges
getExpressionThread
Examples
e = readScript(system.file("samples", "dual.R", package = "CodeDepends"))
getVariableDepends("fit", e, formulaInputs = TRUE)
getVariableDepends("fit", e, formulaInputs = TRUE, asIndex = TRUE)
getVariableDepends("y", e, asIndex = TRUE)
getVariableDepends("y", e)