Try this: with(DF, tapply(code, list(year, month, code), length))
On Tue, Sep 23, 2008 at 8:10 PM, Hutchinson,David [PYR] <[EMAIL PROTECTED]> wrote: > Hi R-Users, > > I have a data frame containing year, month, day, and code columns. The > code column is a unique character of set ('E','A','B') - I am trying to > determine an efficient way of summarizing the count of each of these > codes by month and year without having to use for...loops and subsets. > Does anyone have any suggestions? > > Thanks in advance, > Dave > > Here is a snapshot of my data frame: > > year month day code > 8006 1935 12 1 E > 8007 1935 12 2 > 8008 1935 12 3 E > 8009 1935 12 4 > 8010 1935 12 5 E > 8011 1935 12 6 E > > ______________________________________________ > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O ______________________________________________ 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.