Hi, On Wed, Nov 2, 2011 at 8:44 AM, Celine <bellard.cel...@gmail.com> wrote: > CELLCD AreaProtected > 8928 52.39389 > 8928 41.91511 > 8929 21.21975 > 8929 63.65925 > 8930 26.08547 > 8930 14.04602
You'll need to figure out how you want it to be combined with the original data frame, since there can't be empty cells, but: > dput(testdata) structure(list(CELLCD = c(8928L, 8928L, 8929L, 8929L, 8930L, 8930L), AreaProtected = c(52.39389, 41.91511, 21.21975, 63.65925, 26.08547, 14.04602)), .Names = c("CELLCD", "AreaProtected"), class = "data.frame", row.names = c(NA, -6L)) > > aggregate(testdata$AreaProtected, by=list(CELLCD=testdata$CELLCD), FUN="sum") CELLCD x 1 8928 94.30900 2 8929 84.87900 3 8930 40.13149 -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ 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.