[R] merge

David Meyer david.meyer at ci.tuwien.ac.at
Fri Apr 19 12:30:58 CEST 2002


"juli g. pausas" wrote:
> 
> Dear R-users,
> I'm trying to merge 2 data.frames that have different number of rows,
> with a common column. Is this possible? Here a simple exemple, with the
> error that I get:
> 
> a <- 1:20
> b <- 21:40
> ab <- data.frame(a, b)
> a <- 1:40
> c <- 41:80
> ac <- data.frame(a, c)
> rm(a, b, c)
> zz <- merge(ab, ac, by.x=ab$a, by.y=ac$a)

use sth like

> zz <- merge(ab, ac, by="a")

instead.

g.
-d

> 
> Error in fix.by(by.x, x) : `by' must match numbers of columns
> 
> What's wrong? Any suggestion?
> I'm using R 1.4.1 under MS windows
> Thanks
> 
> Juli
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help 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-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
	Mag. David Meyer		Wiedner Hauptstrasse 8-10
Vienna University of Technology		A-1040 Vienna/AUSTRIA
         Department of			Tel.: (+431) 58801/10772
Statistics and Probability Theory	mail: david.meyer at ci.tuwien.ac.at
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list