[R] Selecting rows that are the same in separate data frames
bartjoosen
bartjoosen at hotmail.com
Tue Dec 9 16:23:53 CET 2008
I'm not sure what you want, but take a look at ?merge and %in%
ppaarrkk wrote:
>
> I want to compare two matrices or data frames and select or get an index
> for those rows which are the same in both. I have tried the following :
>
>
>
>
>
>
> a = matrix ( 1:10, ncol = 2 )
> a
>
> b = matrix ( c ( 2,3,4,7,8,9 ), ncol = 2 )
> b
>
> a[a==b]
>
>
>
>
>
>
> a = as.data.frame ( matrix ( 1:10, ncol = 2 ) )
> a
>
> b = as.data.frame ( matrix ( c ( 2,3,4,7,8,9 ), ncol = 2 ) )
> b
>
> a[a==b]
>
>
>
>
>
>
>
>
> Any ideas please.
>
>
> Thanks.
>
>
> Simon Parker
> Imperial College
>
>
--
View this message in context: http://www.nabble.com/Selecting-rows-that-are-the-same-in-separate-data-frames-tp20916243p20916727.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list