
Last chance! 50% off unlimited learning
Sale ends in
These functions and methods allow one to get the names of the variables used within a script or block of code and from various derived types.
getVariables(x, inputs = FALSE, functions = TRUE, ...)
A character vector, with possibly repeated values, giving the names of the variables. If an annotated script was used, the vector is named by the sections of the script.
the object with information about the variables
a logical indicating wether to include the input
variables or just return the output variables, i.e. those on the
left hand side of of an assignment. Defaults to FALSE
Indicates what types of functions should be
included. NULL
Logical or NULL. Indicages what kind of functions
should be counted as variables: local (TRUE
, the default)(default) indicates none, TRUE
indicates user-defined or unknown provenance functions, and
FALSE
indicates all functions. Ignored if inputs
is
FALSE
.
Passed to getInputs
when generating script
information to comput on.
Duncan Temple Lang
readScript
getInputs
f = system.file("samples", "namedAnnotatedScript.R", package = "CodeDepends")
sc = readScript(f, "labeled")
getVariables(sc)
getVariables(sc[[3]])
Run the code above in your browser using DataLab