[R] how to match or merge data.frames in this case...
Paulo Cardoso
pecardoso at netcabo.pt
Thu Sep 4 02:39:57 CEST 2008
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:vikas at mail.jnu.ac.in]
> Sent: quinta-feira, 4 de Setembro de 2008 1:28
> To: pecardoso at netcabo.pt
> 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
More information about the R-help
mailing list