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)
name | a 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. |
pos | an 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. |
envir | a 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.names | a 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. |
head(objects()) objects("package:base", pattern = "\\[", sorted = FALSE) objects(name = "package:base", all.names = TRUE, pattern = "^\\.P")