[R] colname of ... arguments
Duncan Murdoch
murdoch at stats.uwo.ca
Thu Mar 11 16:08:10 CET 2010
On 11/03/2010 7:25 AM, ManInMoon wrote:
> Duncan,
>
> Thanks you - your deparse(substitute(...)) work - fantastic.
>
> But, when I pass in multiple arguments: f(z[,1],z[,2])
>
> I only show first argument, rest shows up as NULL
>
Yes, that's because substitute has specific meanings for its two
arguments, and only the first one makes sense for you. If you want to
see all the names, you're going to have to use sys.call(), and then pull
out the pieces yourself. For example:
> f <- function(...) {
+ call <- sys.call()
+ print(deparse(call[[1]]))
+ print(deparse(call[[2]]))
+ print(deparse(call[[3]]))
+ }
> f(a, b+c)
[1] "f"
[1] "a"
[1] "b + c"
Duncan Murdoch
More information about the R-help
mailing list