Skip to content
Prev 245461 / 398503 Next

Passing parameter to a function

On 20/12/2010 1:13 PM, Luca Meyer wrote:
I assume that A and B are columns in D?  If so, you could use

tab(D$A, D$B)

to get what you want.  If you really want tab(A,B) to work, you'll need 
to do messy work with substitute, e.g. in the tab function, something like

fla <- substitute(time ~ x + y, list(x = substitute(x), y = substitute(y))
xtabs(fla, data=D)

Duncan Murdoch