On Fri, 19 Apr 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 theYes, see the example on the help page.> 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) > > Error in fix.by(by.x, x) : `by' must match numbers of columnsI think you intended merge(ab, ac, by="a") You can read up on how to specify the `by' columns in the Details section, or just follow the example. -- Brian D. Ripley, ripley at 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-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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
"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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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) 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._