remove and rm can be used to remove objects. These can be specified successively as character strings, or in the character vector list, or through a combination of both. All objects thus specified will be removed. If envir is NULL then the currently active environment is searched first. If inherits is TRUE then parents of the supplied directory are searched until a variable with the given name is encountered. A warning is printed for each variable that is not found.
remove(…, list = character(), pos = -1,
envir = as.environment(pos), inherits = FALSE)<p></p><p>rm (…, list = character(), pos = -1,
envir = as.environment(pos), inherits = FALSE)</p>
| Parameter | Description |
|---|---|
… |
the objects to be removed, as names (unquoted) or character strings (quoted). |
list |
a character vector naming objects to be removed. |
pos |
where to do the removal. By default, uses the current environment. See ‘details’ for other possibilities. |
envir |
the environment to use. See ‘details’. |
inherits |
should the enclosing frames of the environment be inspected? |
# NOT RUN {
tmp <- 1:4
## work with tmp and cleanup
rm(tmp)
# }
# NOT RUN {
## remove (almost) everything in the working environment.
## You will get no warning, so don't do this unless you are really sure.
rm(list = ls())
# }