Thanks:)
 
Regards, Farnoosh Sheikhi


On Thursday, February 13, 2014 1:29 PM, arun <smartpink...@yahoo.com> wrote:
 
Sorry, the library should be 
library(reshape2)






On Thursday, February 13, 2014 4:27 PM, arun <smartpink...@yahoo.com> wrote:
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...@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
        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to