I am curious about variables named starting with a dot. e.g.
.var <- 100
It does not belong to the Global environment. What environment does this variable belong to?
> ls(all.names = TRUE, envir = .GlobalEnv)
[1] ".Random.seed" ".var" "a"
Look at the man page for ls()
by typing ?"ls"
in the console
Below is the quote from the man page for all.names
argument to be passed into ls()
. The environment to look for can be controlled by the envir
argument of ls
command.
By default, ls(all.names = TRUE)
will search for objects in the global environment.
all.names: a logical value. If TRUE, all object names are returned. If FALSE, names which begin with a . are omitted.
Also by passing the environment value to name
argument, one can list all visible and hidden objects of that environment.
search()
ls(name = .GlobalEnv, all.names = TRUE)
ls(name = "package:base", all.names = TRUE)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With