getVariables

0th

Percentile

Get the names of the variables used in code

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.

Keywords
programming
Usage
getVariables(x, inputs = FALSE, functions = TRUE, ...)
Arguments
x

the object with information about the variables

inputs

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

functions

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.

Value

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.

See Also

readScript getInputs

Aliases
  • getVariables
  • getVariables,Script-method
  • getVariables,ScriptInfo-method
  • getVariables,ScriptNode-method
  • getVariables,ScriptNodeInfo-method
  • getVariables,expression-method
Examples
# NOT RUN {
 f = system.file("samples", "namedAnnotatedScript.R", package = "CodeDepends")
 sc = readScript(f, "labeled")
 getVariables(sc)

 getVariables(sc[[3]])
# }
Documentation reproduced from package CodeDepends, version 0.6.5, License: GPL

Community examples

Looks like there are no examples yet.