Does this do what you want: > data1 A B 1 1 a 2 1 b 3 2 c 4 2 d > data2 D E F 1 x y 1 2 w z 2 > data1.1 <- aggregate(data1$B, list(data1$A), FUN=paste, collapse=',') > data1.1 Group.1 x 1 1 a,b 2 2 c,d > merge(data2, data1.1, by.x="F", by.y="Group.1") F D E x 1 1 x y a,b 2 2 w z c,d >
On Wed, Oct 5, 2011 at 5:27 PM, darkgaze <donaldn...@gmail.com> wrote: > Hi all, > > Suppose I have > > data1 > A B > 1 a > 1 b > 2 c > 2 d > > and > > data2 > D E F > x y 1 > w z 2 > > and I want > > data2 > D E F G > x y 1 a,b > w z 3 c,d > > I am trying > > data2$G=list(data1$B[data1$A==data2$F,]) > > How do I correct this approach? > > -- > View this message in context: > http://r.789695.n4.nabble.com/Subsetting-question-tp3876252p3876252.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? ______________________________________________ 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.