Find All Variables Used in an Expression

DESCRIPTION:

Returns a character vector containing the variables in an expression or function.

USAGE:

all.vars(expr, functions = FALSE, max.vars = 200, unique = TRUE) 

REQUIRED ARGUMENTS:

expr
an expression or function.

OPTIONAL ARGUMENTS:

functions
logical, should the names of functions involved in expr be returned.
max.vars
maximum number of names to be returned.
unique
if TRUE, return a name only once, even if it is used several times in expr. Otherwise, the name is included in the value as many times as it appears in expr.

VALUE:

character vector containing the variables in expr. By default, this is the list of unique names occurring in the expression, but not including those names only appearing as the name of a function called from the expression.

SEE ALSO:

.

EXAMPLES:

# How to get all the functions called from f 
all.called <- function(f) { 
        all <- all.names(f, unique = T) 
        all[is.na(match(all, all.vars(f)))] 
}