[R] tapply syntax

David Freedman 3.14david at gmail.com
Fri Mar 26 18:13:24 CET 2010


how about:

d1=data.frame(pat=c(rep('a',3),'b','c',rep('d',2),rep('e',2),'f'),var=c(1,2,3,1,2,2,3,2,4,4))
ds=set(d1,var %in% c(2,3))
with(ds,tapply(var,pat,FUN=length))

hth,
David Freedman, CDC, Atlanta
-- 
View this message in context: http://n4.nabble.com/tapply-syntax-tp1692503p1692553.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list