[R] Aggregate to find majority level of a factor

Thompson, Jonathan jonathan.thompson at oregonstate.edu
Thu May 31 21:25:44 CEST 2007

I want to use the aggregate function to summarize data by a factor (my
field plots), but I want the summary to be the majority level of another

For example, given the dataframe:

Plot1     big
Plot1     big
Plot1     small
Plot2     big
Plot2     small    
Plot2     small
Plot3     small
Plot3     small
Plot3     small

My desired result would be:
Plot1 big
Plot2 small
Plot3 small

I can't seem to find a scalar function that will give me the majority

Thanks in advance,

Jonathan Thompson

More information about the R-help mailing list