[R] intersection between two matrices based on two columns in R

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Wed Sep 9 21:48:10 CEST 2015

Matrices and data frames are write different. For this you most likely want to use days frames.


Using typical options merge gives you all columns from both data frames. You can choose to select specific columns by indexing the data frames before passing them to merge if you don't want that.
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

On September 9, 2015 12:39:43 PM PDT, Lida Zeighami <lid.zigh at gmail.com> wrote:
>Hi there,
>I want to find the intersection between two different data frame or
>matrices based on two columns.
>for example in matrix A I have 5 columns, the first two columns are Id1
>Id2 and I have the same columns in the other matrix B, (Id1, Id2 ,,,)
>how can I find the intersection between these two matrices based on
>Id1 and Id2 in R?
>	[[alternative HTML version deleted]]
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list