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. I thought the default behavior was only matching rows are included, but that using all.x=T included rows with unmatched x's as well. If all the y's are unique, though, I don't understand how length(r) > length(x) is possible. Some clarification would be great. Thanks, Mitch [[alternative HTML version deleted]]
I was mistaken. There were duplicates in my y vector. Please ignore my previous message. Sorry. -----Original Message----- From: Downey, Patrick Sent: Thu 6/30/2011 11:08 PM To: r-help@r-project.org Subject: merge function 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. I thought the default behavior was only matching rows are included, but that using all.x=T included rows with unmatched x's as well. If all the y's are unique, though, I don't understand how length(r) > length(x) is possible. Some clarification would be great. Thanks, Mitch [[alternative HTML version deleted]]
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. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. "Downey, Patrick" <PDowney@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. I thought the default behavior was only matching rows are included, but that using all.x=T included rows with unmatched x's as well. If all the y's are unique, though, I don't understand how length(r) > length(x) is possible. Some clarification would be great. Thanks, Mitch [[alternative HTML version deleted]] _____________________________________________ R-help@r-project.org mailing list stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]