[Rd] Merge (PR#9699)

ripley at stats.ox.ac.uk ripley at stats.ox.ac.uk
Mon May 28 13:57:19 CEST 2007

On Mon, 21 May 2007, edward.m at psu.ac.th wrote:

> Full_Name: Edward McNeil
> Version: 2.5.0
> OS: Windows XP
> Submission from: (NULL) (
> This is a new bug introduced to R2.5.0.
> Scenario: If one of the data frames to merge contains two variables that have
> the same name, then the data in first variable (of the same name) is copied to
> the second variable in the resulting merged data frame.

This is probably

     o	<a data.frame>[i, j] could sometimes select the wrong column
 	when j is numeric if there are duplicate column names.

from NEWS and hence already fixed in R-patched.

> In R2.4.1, the second variable name is automatically renamed (in the resulting
> data frame) by adding ".1" to the end. R2.5.0 doesn't seem to do this anymore.

This is not reproducible:

A <- data.frame(x=1:3, y=4:6, y=7:9, check.names=FALSE)
B <- data.frame(x=1:3, a=3:1)
merge(A, B)

works correctly in R-patched.  You were asked for a reproducible example: 
if you have one in current R-patched, please supply it now (using PR#9699 
early in your subject line).

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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list