Hi Again..,
All of my 2 tables are data.frames and the order of meals does not matter. Meal A =2 and Meal B= 15 is the same as Meal A=15 and Meal B= 2. ________________________________ From: Bert Gunter <bgunter.4...@gmail.com> Sent: 22 May 2017 03:19:57 To: Allaisone 1 Cc: r-help@r-project.org Subject: Re: [R] Identyfing rows with specific conditions More clarification: Are your "tables" matrices or data frames? (If you don't know what this means, you need to spend a little time with a e.g. web tutorial to learn). Also, does Meal A Meal B order count? -- i.e. is Meal A = 2, Meal B = 15 the same as Meal A = 15 and Meal B = 2? This is important. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sun, May 21, 2017 at 5:10 PM, Allaisone 1 <allaiso...@hotmail.com> wrote: > > Hi All.., > > I have 2 tables. The first one contains 2 columns with the headers say "meal > A code" & "meal B code " in a table called "Meals" with 2000 rows each of > which with a different combination of meals(unique combination per row). > > >>Meals > > meal A code meal B code > > 1 34 66 > > 2 89 39 > > 3 25 77 > > The second table(customers) shows customers ids in the first column with > Meals codes(M) next to each customer. There are about 300,000 customers > (300,000 rows). > >> Customers > 1 2 3 4 ..30 > id M1 M2 M3 > 1 15 77 34 25 > 2 11 25 34 39 > 3 85 89 25 77 > . > . > 300,000 > > I would like to identify all customers ids who have had each meal combination > in the first table so the final output would be the first table with ids > attached next to each meal combination in each row like this: > >>IdsMeals > > > MAcode MBcode ids > > 1 34 39 11 > > 2 25 34 15 11 > > 3 25 77 15 85 > > Would you please suggest any solutions to this problem? > > Regards > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.