R-beta: An all.names function
Douglas Bates
bates at stat.wisc.edu
Mon Apr 28 15:11:31 CEST 1997
I could not find the all.names function in R so I created the
enclosed. Comments, criticisms, or changes to a one-liner by creating
nested anonymous functions are welcome. I'll try to work out a
corresponding all.vars function.
### $Id: allFns.R,v 1.2 1997/04/28 13:08:21 bates Exp $
### Some replacement functions that are missing in R
### Determine all the names (symbols) occuring in an object.
### This is probably grossly inefficient.
all.names <-
function (x)
{
if (mode(x) == "symbol")
return(as.character(x))
if (length(x) == 0)
return(NULL)
if (is.recursive(x))
return(unlist(lapply(as.list(x), all.names)))
character(0)
}
### Local variables:
### mode: R
### End:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
More information about the R-help
mailing list