[R] Counting character occurrences in data frame

Hutchinson,David [PYR] David.Hutchinson at ec.gc.ca
Wed Sep 24 01:10:50 CEST 2008


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



More information about the R-help mailing list