[Rd] merge (PR#1510)

ripley@stats.ox.ac.uk ripley@stats.ox.ac.uk
Fri, 3 May 2002 18:16:32 +0200 (MET DST)


On Fri, 3 May 2002, Thomas Lumley wrote:

> On Fri, 3 May 2002 elff@rumms.uni-mannheim.de wrote:
>
> > Full_Name: Martin Elff
> > Version: 1.5.0
> > OS: MS Windows 98
> > Submission from: (NULL) (134.155.91.46)
> >
> >
> > Merging of two data frames by variables with different names
> > (using by.x and by.y) is no
> > longer possible (it was possible in version 1.4.1).
>
> To be precise, it doesn't seem to work with multiple by columns, so
> > df<-data.frame(x=1:10,y=rnorm(10))
> > fd<-data.frame(z=1:10,w=rnorm(10))
> > merge(df,fd,by.x="x",by.y="z")
> succeeds but

Yes, and there is an example on the help page for that case.

> > fd<-data.frame(z=1:10,m=letters[1:10],w=rnorm(10))
> > df<-data.frame(x=1:10,y=rnorm(10),n=letters[1:10])
> > merge(df,fd,by.x=c("x","n"),by.y=c("z","m"))
> Error in match.names(clabs, names(xi)) : names don't match previous names:
>          z, m

Yes, the code is different for multiple match columns, and I know how to
fix it.

Thank you Thomas for the example: creating one was my next task.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._