[R] merge aint merging

Peter Malewski y0004379 at tu-bs.de
Wed Jul 26 11:05:07 CEST 2000


On Wed, 26 Jul 2000, Strumila, John wrote:

> > nrow(xx)
> [1] 9683
> > nrow(yy)
> [1] 984
> > nrow(zz)
> [1] 984

The Problem is that merge only keep cases, which are both in xx + yy
(intersection). A work arount might be to use match instead:

> x <- data.frame(id=1:10,21:30)
> y <- data.frame(id=1:11,21:31)
> dim(x)
[1] 10  2
> dim(y)
[1] 11  2
> dim(merge(x,y,by="id"))
[1] 10  3
> y$x <- x[match(y$id,x$id),2]


or is there a hidden all, all.x, all.y in merge?

Peter

** To YOU I'm an atheist; to God, I'm the Loyal Opposition. Woody Allen **
P.Malewski					Tel.: 0531 500965
Maschplatz 8					Email: P.Malewski at tu-bs.de
************************38114 Braunschweig********************************

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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