all.names
Find All Names in an Expression

Description

Get the name objects from a language object.

Usage

all.names(expr, functions = TRUE, max.names = -1L, unique = FALSE)
all.vars(expr, functions = FALSE, max.names = -1L, unique = TRUE)

Arguments

expr a language object, typically a call. (N.B., a function is not a language object: use is.language to check.)
functions a logical value. If FALSE do not include the names of functions in function calls in the result. If TRUE do include them. Note that functions also include operators such as "+", "*", etc.
max.names an integer value giving the maximum number of names to be returned. The default is -1, meaning there is no limit.
unique if TRUE, return a name only once, even if it is used several times in expr. If FALSE, the name is included in the value as many times as it appears in expr.

Details

all.vars and all.names differ only in the default values of the functions and unique arguments. all.names, by default, returns a vector of all the names, including duplicates, in expr. all.vars, by default, omits the names of called functions and duplicates.
Value
character vector containing the names in expr
See Also
expression, terms.
Examples
all.names(y ~ x1 + x2 + log(x2, base=2))
# [1] "~"   "y"   "+"   "+"   "x1"  "x2"  "log" "x2"

all.names(y ~ x1 + x2 + log(x2, base=2), unique=TRUE) # [1] "~" "y" "+" "x1" "x2" "log"

all.vars(y ~ x1 + x2 + log(x2, base=2)) # [1] "y" "x1" "x2"

Package base version 4.0.0-28
Package Index