I am trying to pass a couple of variable names to a xtabs formula:

> tab <- function(x,y){
    xtabs(time~x+y, data=D)
}

But when I run:

> tab(A,B)

I get:

Error in eval(expr, envir, enclos) : object "A" not found

I am quite sure that there is some easy way out, but I have tried with 
different combinations of deparse(), substitute(), eval(), etc without success, 
can someone help?

Thanks,
Luca

Luca Meyer
www.lucameyer.com
IBM SPSS Statistics release 19.0.0
R version 2.12.1 (2010-12-16)
Mac OS X 10.6.5 (10H574) - kernel Darwin 10.5.0

______________________________________________
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