Yes, I tried, but the order of the IDs in dat1 and dat2 is not exactly the same, I simplify the data here. So in dat2, it may have records for ID=0002 first then ID=0001, also I have more than two categories under ID col.
On Tue, May 7, 2013 at 10:57 AM, Chris Stubben <stub...@lanl.gov> wrote: > > I want to merge dat1 and dat2 based on "ID" in order > > Have you tried merge(dat1, dat2) ? > > If ID is the common column (and no others), then that should be all you > need to join (see ?merge). And then order if needed. > > Chris > > > > -- > > Chris Stubben > > Los Alamos National Lab > Bioscience Division > MS M888 > Los Alamos, NM 87545 > > ______________________________**________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> > PLEASE do read the posting guide http://www.R-project.org/** > posting-guide.html <http://www.R-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > [[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.