Andrew Have you tried:
dat2[!paste(dat2[,1], dat2[,2])%in%paste(dat1[,1], dat1[,2]),] ? HTH .... Peter Alspach > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Andrew McFadden > Sent: Monday, 12 May 2008 9:40 a.m. > To: r-help@r-project.org > Subject: [R] Finding unmatched data between two dataframe > using severalfactors > > Hi R users > > I am trying to find unmatched data from two dataframes. I > would like to find unmatched data based on several factors. > For the following data: > > dat1 <- data.frame(x = paste("A", 1:6, sep=""), > y = c("andy","bob","ciaran","dan", "eion", > "fred")) > dat1 > > > dat2 <- data.frame(x = paste("A", c(1,2,3,5,6), sep=""), > y = c("andy", "bob", "ciaran", > "dan", "zane"),z=c(10,20,30,40,50)) > > dat2 > > > I would like to know data that from dat2 that doesn't appear in dat1 > based on both the x and y factors ie (A5, dan, 40) and (A6,zane, 50). > > I have tried two approaches but have not been successful > > ? nomatch <- subset(dat1, is.element(?) == FALSE) > ? setdiff(dat1$x,dat2$y) > > Any thoughts would be great > > Regards > > Andy > > Andrew McFadden MVS BVSc > Incursion Investigator > Investigation & Diagnostic Centres - Wallaceville Biosecurity New > Zealand Ministry of Agriculture and Forestry > > Phone 04 894 5600 Fax 04 894 4973 Mobile 029 894 5611 Postal address: > Investigation and Diagnostic Centre- Wallaceville Box 40742 Ward St > Upper Hutt > > > ############################################################## > ########## > This email message and any attachment(s) is intended solely for the > addressee(s) named above. The information it contains is confidential > and may be legally privileged. Unauthorised use of the > message, or the > information it contains, may be unlawful. If you have received this > message by mistake please call the sender immediately on 64 4 8940100 > or notify us by return email and erase the original message and > attachments. Thank you. > > The Ministry of Agriculture and Forestry accepts no responsibility for > changes made to this email or to any attachments after > transmission from > the office. > ############################################################## > ########## > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. > The contents of this e-mail are privileged and/or confidential to the named recipient and are not to be used by any other person and/or organisation. If you have received this e-mail in error, please notify the sender and delete all material pertaining to this e-mail. ______________________________________________ R-help@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.