clear | R Documentation |
clear
removes the variables, matched by the pattern,
from the environment (the default is parent environment).
It will return the name of variables which have been removed.
clear(pattern = "*", all.names = FALSE, envir = parent.frame())
pattern |
A character string. The regular expression pattern of variable names to be removed. |
all.names |
Logical. If TRUE, all object names are removed (except .Random.seed). If FALSE, object names which begin with a . are omitted. |
envir |
An alternative argument to name for specifying the environment. |
The name of variables which have been removed.
rm
, https://github.com/paodan/funcTools
## Not run:
# Remove all (visible) variables in the Global Environment.
x1 = 1
x3 = "a"
xx = TRUE
y = function(x) x
y1 = 1:4
yx = list(y = 1, x = 3)
.x = data.frame(rnorm(5))
ls(all.names = TRUE)
clear()
ls(all.names = TRUE)
# Remove all variables including (invisible) variables begin with a ".".
clear(all.names = TRUE)
ls(all.names = TRUE)
# Remove variables begin with "x".
x1 = 1
x3 = "a"
xx = TRUE
y = function(x) x
y1 = 1:4
yx = list(y = 1, x = 3)
.x = data.frame(rnorm(5))
clear("^x")
ls(all.names = TRUE)
# Remove variables end with "x".
clear("x$")
ls(all.names = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.