objects
Retrive a List of Objects

Description

Returns the names of S objects from the environments or packages in the search list or the objects from a memory frame.

Usage

objects(name, pos = -1, envir = as.environment(pos), 
   all.names = FALSE, pattern, sorted = TRUE)
ls(name, pos = -1, envir = as.environment(pos), all.names = FALSE, 
   pattern, sorted = TRUE)

Arguments

namea character string or an integer value that corresponds to an environment or package from the search list (search()). Optionally, you can enclose the character string in quotation marks. Missing values are allowed.
posan integer value or a character string that corresponds to the position of an environment or package in the search list (search()). When you specify a name, the pos argument is ignored.
envira character string, enclosed in quotation marks, or an integer value that corresponds to an environment or package from the search list (search()). A value specified in envir overrides values specified in name and pos. If you do not specify a value for envir, the value for either name or pos is coerced to environment(as.environment).
all.namesa logical value. If TRUE, all objects, including hidden objects, are listed.
pattern a character vector that specifies a valid regular expression. Returns a list of objects that match the regular expression.

The regular expression must contain matching sets of "[" and "]"; otherwise, it replaces the non-matched "[" with "\\[". If the regular expression contains the character string "[<-" that precedes any character except "\\", it replaces "[<-" with "\\[<-".

sorted a logical value. If TRUE (the default), the returned vector of names are in alphabetical order. Setting to FALSE, indicating no sorting, can save some time.

Details

ls is an alias of objects. Both have the same effects, arguments, and values.
names(envir), where envir is an environment, returns the same thing as objects(envir=envir, all.names=TRUE, sorted=FALSE).
Value
returns a character vector that lists the names of objects contained in the element specified by name, pos, or envir.
See Also
grep, ls, regexpr, names.
Examples
head(objects())
objects("package:base", pattern = "\\[", sorted = FALSE)
objects(name = "package:base", all.names = TRUE, pattern = "^\\.P")
Package base version 6.1.1-7
Package Index