getVariables {CodeDepends}R Documentation

Get the names of the variables used in code

Description

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.

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.

Author(s)

Duncan Temple Lang

See Also

readScript getInputs

Examples

 f = system.file("samples", "namedAnnotatedScript.R", package = "CodeDepends")
 sc = readScript(f, "labeled")
 getVariables(sc)

 getVariables(sc[[3]])

[Package CodeDepends version 0.6.5 Index]