powered by
Remove (all) objects from environment
erase(pattern = NULL, envir = parent.frame(), verbose = FALSE)
regex pattern to select a set of objects; default: NULL
environment; default: caller environment
print removed objects' names
NULL (function returns nothing)
Function can be used with envir = globalenv() argument.
# NOT RUN { create_data <- function() data.frame(a = 1:10, b = 11:20) x <- cars y <- 1:20 z <- function(x) x +2 # Typically, we don't have to specify enironment erase() ls() # }
Run the code above in your browser using DataLab