?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
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
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
3 matches
Mail list logo