Re: [R] Compare two data sets

2008-03-26 Thread jim holtman
Easiest way to do it is to try it out and time it. Here is a case where I generated two sets of data with 120,000 characters each (just random numbers converted to character strings) and then asked for the intersection of them. Came up with 3 matched in about 0.2 seconds. That would seem fastest

Re: [R] Compare two data sets

2008-03-25 Thread Suhaila Zainudin
Hi, Thanks for the feedback. I have tried it on the small size sample and ref and it works. Now I want to use a larger dataset for myref (the reference file) . The reference file contains 112189 rows. Can I use the same approach that works for the small example? Or are there other alternatives whe

Re: [R] Compare two data sets

2008-03-25 Thread jim holtman
Here is one way to find the common rows. You can then use the 'keys' gotten back to reconstruct a new data frame: > f1 <- read.table(textConnection("V1 V2 + YBL064C YBR067C + YBL064C YBR204C + YBL064C YDR368W + YBL064C YJL067W + YBL064C YPR160W + YBR053C YGL089C + YBR053C YHR113W + YBR053C Y

Re: [R] Compare two data sets

2008-03-25 Thread Suhaila Zainudin
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 Y

Re: [R] Compare two data sets

2008-03-25 Thread David Winsemius
<[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > I would like to compare two data sets saved as text files (example > below) to determine if both sets are identical(or if dat2 is missing > information that is included in dat1) and if they are not identical > list what information is differe

Re: [R] Compare two data sets

2008-03-25 Thread jim holtman
Here is how to find the values in common: > dat1 <- paste('a', 1:6, sep='') > dat2 <- paste('a', c(2,4:6), sep='') > # find the data in common > intersect(dat1, dat2) [1] "a2" "a4" "a5" "a6" > On 3/25/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I would like to compare two data sets saved