Skip to content
Back to formatted view

Raw Message

Message-ID: <1392326849.60793.YahooMailNeo@web142606.mail.bf1.yahoo.com>
Date: 2014-02-13T21:27:29Z
From: arun
Subject: Aggregation
In-Reply-To: <1392321580.43879.YahooMailNeo@web141701.mail.bf1.yahoo.com>

HI Farnoosh,

You can use ?dcast()
library(plyr)

?dcast(DataA,ID~Var1,value.var="Var2")
#? ID?? A?? B
#1? 1 100? 50
#2? 2 200 100
A.K.




On Thursday, February 13, 2014 2:59 PM, farnoosh sheikhi <farnoosh_81 at yahoo.com> wrote:

Hi Arun,

I hope all is well. I need to aggregate a data like below:

DataA

ID ? ? ? Var1 ? Var2
1? ? ? ? A100
1B50
2? ? ? ? A200
2B100


The transformed data should be like below:
ID ? AB
1100 ? 50
2200100


Thanks a lot.

Regards,?Farnoosh Sheikhi