HI,
Try this:
dat1<- read.table(text="
V1??? V2
A????? 1
B????? 2
A???? 1
B????? 3
",sep="",header=TRUE,stringsAsFactors=FALSE)
library(plyr)
ddply(dat1,.(V1),summarize, V2=list(V2))
#? V1?? V2
#1? A 1, 1
#2? B 2, 3
#or
aggregate(V2~V1,data=dat1,FUN= function(x) x,simplify=FALSE)
#? V1?? V2
#1? A 1, 1
#2? B 2, 3
A.K.
>Dear R-users,
>
>I have dataframe
>V1 ? ?V2
>A ? ? ?1
>B ? ? ?2
>A ? ? 1
>B ? ? ?3
>
>I want to get this output
>
>V1 ? ? ? ? V2
>A ? ? ? 1,1
>B ? ? ? 2 ,3
>
>
>How to.... ??
>
>Please