Perfect, with a minor extension to get the desired result: mergeddata <- merge(dataframe.1, dataframe.2,by=c("id1","id2"),all.x=T) mergeddata$boundary.x[mergeddata$boundary.y==0] <- 0
Thank you Vikas > -----Original Message----- > From: Vikas Rawal [mailto:[EMAIL PROTECTED] > Sent: quinta-feira, 4 de Setembro de 2008 1:28 > To: [EMAIL PROTECTED] > Subject: Re: [R] how to match or merge data.frames in this case... > > > I'm trying to match two data frames in order to replace the boundary > values > > in a dataframe.1 with values in dataframe.2 ONLY where the pair id1 > id2 > > matches between the two data frames. > > merge(dataframe.1,dataframe.2,by=c("id1","id2"))->mergeddata > > Vikas > > > > *********************************************************************** > ***********************If the reader of this e-mail is not the intended > recipient(s), please be advised that any dissemination, distribution or > copying of this information is strictly prohibited. Whilst Jawharlal > Nehru University aims to keep its network free from viruses, you are > strongly advised to check this e-mail and any attachments for viruses, > as the University shall NOT ACCEPT any liability with regard to > computer viruses transferred by way of e- > mail.****************************************************************** > ****************************This message has been scanned for viruses > by GWGUARDIAN > No virus found in this incoming message. > Checked by AVG. > Version: 8.0.100 / Virus Database: 270.6.16/1650 - Release Date: 03-09- > 2008 16:13 ______________________________________________ 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.