[R] Sum with condition

Celine bellard.celine at gmail.com
Wed Nov 2 13:44:22 CET 2011


I guess my problem is simple for most of you but I am new with R and I need
some help,
I have a dataframe : 

CELLCD AreaProtected
   8928      52.39389
   8928      41.91511
   8929      21.21975
   8929      63.65925
   8930      26.08547
   8930      14.04602

I wouldlike to sum the AreaProtected if it is the same CELLCD in another
column :

CELLCD AreaProtected    SumAreaProtected
   8928      52.39389      94.309
   8928      41.91511
   8929      21.21975      84,879
   8929      63.65925
   8930      26.08547
   8930      14.04602

I am just started with R and I don't know how I can do that.
Do you have any ideas ?


Thanks a lot for your help,

--
View this message in context: http://r.789695.n4.nabble.com/Sum-with-condition-tp3972839p3972839.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list