On Jul 1, 2011, at 06:48 , Jeff Newmiller wrote: > You haven't provided a reproducible example. > > I do notice you are using T and F which are variables that can be redefined > (which is why TRUE and FALSE are preferred.
Also, if x and y really are "vectors" (I bet they're not, though), you'll get the cartesian product whatever all.x and all.y are, unless you specify by.x="x" and by.y="y". I.e., > merge(1:3,2:4,all.y=F,all.x=T) x y 1 1 2 2 2 2 3 3 2 4 1 3 5 2 3 6 3 3 7 1 4 8 2 4 9 3 4 > merge(1:3,2:4,by.x="x",by.y="y") x 1 2 2 3 > merge(1:3,2:4,by.x="x",by.y="y", all.x=T) x 1 1 2 2 3 3 All just to point out the importance of actual examples. Mind reading is sort of fun and some correspondents on mailing lists get rather good at it, but it is more expedient to have a well-defined problem from the outset. -pd > > "Downey, Patrick" <pdow...@urban.org> wrote: > > Hello, > > I'm clearly confused about the merge function. In the following > > r <- merge(x,y,all.x=T,all.y=F) > > my y vector has only unique values (no duplicates). So I don't understand > how this can ever generate an r which is of greater length than x. -- Peter Dalgaard Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.