[R] Getting names of objects passed with "..."
Mike Meredith
mmeredith at wcs.org
Fri Jun 1 06:44:46 CEST 2007
Is there a tidy way to get the names of objects passed to a function via the
"..." argument?
rbind/cbind does what I want:
test.func1 <- function(...) {
nms <- rownames(rbind(..., deparse.level=1))
print(nms)
}
x <- "some stuff"
second <- "more stuff"
test.func1(first=x, second)
[1] "first" "second"
The usual 'deparse(substitute())' doesn't do it:
test.func2 <- function(...) {
nms <- deparse(substitute(...))
print(nms)
}
test.func2(first=x, second)
[1] "x"
I'm using "nms <- rownames(rbind(...))" as a workaround, which works, but
there must be a neater way!
rbind/cbind are .Internal, so I can't pinch code from there.
Thanks, Mike.
--
View this message in context: http://www.nabble.com/Getting-names-of-objects-passed-with-%22...%22-tf3850318.html#a10906614
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list