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

______________________________________________
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.

Reply via email to