Re: [R] Compare two data sets

From: Suhaila Zainudin <suhaila.zainudin_at_gmail.com>
Date: Tue, 25 Mar 2008 19:18:16 -0700

Hi,

I have a similar query (how to compare 2 datasets), but my dataset is a bit different.
I want to compare each data in dataset 1 to data in dataset 2 and get the data which is common to both datasets.

For example;

I have a a file (named mysample).

V1 V2
YBL064C YBR067C
YBL064C YBR204C
YBL064C YDR368W
YBL064C YJL067W
YBL064C YPR160W
YBR053C YGL089C
YBR053C YHR113W
YBR053C YNL328C And I have another file (myref) as follows

V1 V2
YBL064C YBR067C
YBL064C YBR204C
YBL064C YDR368W When I try to intersect the two files, I received NULL data frames.

> intersect(myref,mysample)

NULL data frame with 0 rows

What I am hoping to get out of intersect for the above files are

YBL064C YBR067C
YBL064C YBR204C
YBL064C YDR368W Are there any R functions that can achieve what I want to do? Or should I merge the data which is currently in 2 columns into single column and use intersect again?

Thanks for any feedbacks!

        [[alternative HTML version deleted]]



R-help_at_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. Received on Wed 26 Mar 2008 - 05:21:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 26 Mar 2008 - 06:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive