Returns the function environment as list. Raises an error when called outside a function. By default, objects specified as arguments are removed from the environment.
Usage
function_locals(without = c(), strip_function_args = TRUE)
Examples
f <- function(a = 1, b = 2) {
x <- 3
y <- 4
return(function_locals())
}
all.equal(setdiff(f(), list(x = 3, y = 4)), list())
#> [1] "Attributes: < Modes: list, NULL >"
#> [2] "Attributes: < Lengths: 1, 0 >"
#> [3] "Attributes: < names for target but not for current >"
#> [4] "Attributes: < current is not list-like >"