I have spent a whole afternoon searching for the solution, but got nothing so far. It should be a simple problem. I have two datasets to merge. The first one just contains two ID columns and it looks like:
FromID ToID 1 2 1 3 2 1 2 3 3 1 3 2 The second one contains a ID column and a variable: ID X 1 100 2 150 3 130 What I want is to merge the two datasets together using the ToID and ID. The final merged dataset should look like: FromID ToID X 1 2 150 1 3 130 2 1 100 2 3 130 3 1 100 3 2 150 The Merge command doesn't work well. I also don't want to use for loop. I feel that there must be some subscripting or other tricks to use, but I couldn't figure it out. Any help is appreciated!! -Hongwei -- View this message in context: http://n4.nabble.com/Question-about-many-to-one-merge-tp1018811p1018811.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.