Find All Names in an Expression

DESCRIPTION:

This function examines the value of its first argument (an expression, possibly a S-PLUS function) and scans it for all names (objects and functions).

USAGE:

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

REQUIRED ARGUMENTS:

expr
an expression or function.

OPTIONAL ARGUMENTS:

functions
logical, should the names of functions involved in expr be returned. Note that functions also include operators such as "+", "*", etc. Default is TRUE
max.names
maximum number of names to be returned. Default is 200.
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. Default is FALSE

VALUE:

character vector containing the names in expr (in breadth-first order, if unique is FALSE).

SEE ALSO:

.

EXAMPLES:

methods <- expression(lsfit(x, y), l1fit(x, y)) 
all.names(methods) 
# produces the following output: 
 [1] "lsfit" "x"     "y"     "l1fit" "x"     "y" 
all.names(all.names, unique = T) 
# produces the following output: 
  [1] "T"          "F"          "z"          ".C"         "list" 
  [6] "expr"       "as.integer" "functions"  "character"  "max.names" 
 [11] "vector"     "unique"     ">="         "$"          ">" 
 [16] "*"          "x"          "length"