Learn R Programming

toscutil (version 2.8.0)

locals: Get specified Environment as List

Description

Return all symbols in the specified environment as list.

Usage

locals(without = c(), env = parent.frame())

Value

Specified environment as list (without the mentioned symbols).

Arguments

without

Character vector. Symbols from current env to exclude.

env

Environment to use. Defaults to the environment from which locals is called.

Examples

Run this code
f <- function() {
     x <- 1
     y <- 2
     z <- 3
     locals()
}
ret <- f()
stopifnot(identical(ret, list(z = 3, y = 2, x = 1)))

Run the code above in your browser using DataLab