env_clear()
Clear R environment
Cleans up the R environment by removing objects, closing plots, detaching packages, and running garbage collection. Does not clear the console.
Usage
env_clear(keep = character(), envir)
Arguments
| Name | Description |
|---|---|
| keep |
Character vector of object names to keep (default: empty) |
| envir |
The environment to clear |
Value
Invisibly returns NULL
Examples
if (FALSE) {
# Clean a specific environment
env_clear(envir = my_env)
# Keep specific objects
env_clear(keep = c("config", "data"), envir = my_env)
}