Hi all, I want to combine two data sets (ZA and ZB to get ZAB). The common variable between the two data sets is ID. Data ZA ID F M 1 0 0 2 0 0 3 1 2 4 1 0 5 3 2 6 5 4 Data ZB ID v1 v2 v3 3 2.5 3.4 302 4 8.6 2.9 317 5 9.7 4.0 325 6 7.5 1.9 296 Output (ZAB) ID F M v1 v2 v3 1 0 0 -9 -9 -9 2 0 0 -9 -9 -9 3 1 2 2.5 3.4 302 4 1 0 8.6 2.9 317 5 3 2 9.7 4.0 325 6 5 4 7.5 1.9 296 Any help is highly appreciated in advance, Val [[alternative HTML version deleted]]
?merge On Mon, Mar 29, 2010 at 7:13 AM, Val <valkremk@gmail.com> wrote:> Hi all, > > I want to combine two data sets (ZA and ZB to get ZAB). > The common variable between the two data sets is ID. > > Data ZA > ID F M > 1 0 0 > 2 0 0 > 3 1 2 > 4 1 0 > 5 3 2 > 6 5 4 > > Data ZB > > ID v1 v2 v3 > 3 2.5 3.4 302 > 4 8.6 2.9 317 > 5 9.7 4.0 325 > 6 7.5 1.9 296 > > Output (ZAB) > > ID F M v1 v2 v3 > 1 0 0 -9 -9 -9 > 2 0 0 -9 -9 -9 > 3 1 2 2.5 3.4 302 > 4 1 0 8.6 2.9 317 > 5 3 2 9.7 4.0 325 > 6 5 4 7.5 1.9 296 > > Any help is highly appreciated in advance, > > Val > > [[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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[alternative HTML version deleted]]
Val, Type "combine two data sets" (text you wrote in your post) into www.rseek.org. The first two links are: "Quick-R: Merge" and "Merging data: A tutorial". Isn't it quicker for you to use rseek, rather than the time it takes to write a post and wait for a reply ? Don't you also get more detailed information that way too ? You already received advice from others on this list to look at www.rseek.org on 26 Oct, package 'sos' on 27 Oct, and to 'read the manuals and FAQs before posting' on 5 Nov. This month you have posted 3 times : "Loop", "Renumbering" and "Combing". References : 1. Posting Guide headings : "Do your homework before posting" and "Further resources" 2. Contributed Documentation e.g. 'R Reference Card' by Tom Short http://cran.r-project.org/doc/contrib/Short-refcard.pdf. 3. Eric Raymond's essay http://www.catb.org/~esr/faqs/smart-questions.html. e.g. you posted to r-help 10 times so far, 9 of the 10 subjects were either a single word, or a single function name. HTH Matthew "Val" <valkremk at gmail.com> wrote in message news:cdc083ac1003290413s7e047e25lc4202568af119f91 at mail.gmail.com...> Hi all, > > I want to combine two data sets (ZA and ZB to get ZAB). > The common variable between the two data sets is ID. > > Data ZA > ID F M > 1 0 0 > 2 0 0 > 3 1 2 > 4 1 0 > 5 3 2 > 6 5 4 > > Data ZB > > ID v1 v2 v3 > 3 2.5 3.4 302 > 4 8.6 2.9 317 > 5 9.7 4.0 325 > 6 7.5 1.9 296 > > Output (ZAB) > > ID F M v1 v2 v3 > 1 0 0 -9 -9 -9 > 2 0 0 -9 -9 -9 > 3 1 2 2.5 3.4 302 > 4 1 0 8.6 2.9 317 > 5 3 2 9.7 4.0 325 > 6 5 4 7.5 1.9 296 > > Any help is highly appreciated in advance, > > Val > > [[alternative HTML version deleted]] >