Feng Li wrote:
Dear R,
Why rm(list<-ls()) gives an error but rm(list=ls()) not? I remember the
operator ‘<-’ can be used anywhere...
Yes, and it means that you make an assignment once passed to the first
argument "..." in rm() and evaluated. Well, it is just never evaluated
since "..." needs to be a name or a character vector (and is a language
object in this case), hence an error in rm().
You can do:
rm(list=(list <- ls()))
of course, which does what you are intending, I guess: assigns the ls()
to list and removes all objects given in list, since list is passed to
the argument list.
Uwe Ligges
Thanks!
Feng
------------------------------------------------------------------------
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.