Re: [R] Sum according observation

2009-09-18 Thread John Kane
?aggregate with(xx,aggregate(var2, list(var1=var1),sum) --- On Fri, 9/18/09, MarcioRibeiro wrote: > From: MarcioRibeiro > Subject: [R] Sum according observation > To: r-help@r-project.org > Received: Friday, September 18, 2009, 11:18 AM > > Hi listers, > I have a sim

Re: [R] Sum according observation

2009-09-18 Thread Henrique Dallazuanna
Try this: with(DF, tapply(var2, var1, sum)) On Fri, Sep 18, 2009 at 12:18 PM, MarcioRibeiro wrote: > > Hi listers, > I have a simple doubt... > I need to manipulate the data base as: > > var1 var2 > 7      0.1 > 7      0.1 > 8      0.12 > 10    0.15 > 12    0.18 > 20    0.31 > > I would like to

[R] Sum according observation

2009-09-18 Thread MarcioRibeiro
Hi listers, I have a simple doubt... I need to manipulate the data base as: var1 var2 7 0.1 7 0.1 8 0.12 100.15 120.18 200.31 I would like to aggregate the equal cases as var1 making the sum of var2... I would get... var1 var2 7 0.2 8 0.12 100.15 120