[R] aggregating strings

Dry, Jonathan R Jonathan.Dry at astrazeneca.com
Tue Jul 28 17:34:35 CEST 2009


I am currently summarising a data set by collapsing data based on common identifiers in a column.  I am using the 'aggregate' function to summarise numeric columns, i.e. "aggregate(dat[,3], list(dat$gene), mean)".  I also wish to summarise text columns e.g. by concatenating values in a comma separated list, but the aggregate function can only return scalar values and so something like "aggregate(dat[,3], list(dat$gene), cat)" will not work.  Is there a simple function like aggregate that works for strings in R?

--------------------------------------------------------------------------
AstraZeneca UK Limited is a company incorporated in Engl...{{dropped:21}}




More information about the R-help mailing list