[Rd] Merge (PR#9699)

edward.m at psu.ac.th edward.m at psu.ac.th
Mon May 28 15:30:52 CEST 2007


Yes, it appears to have been resolved in R2.5.0pat, although the 
counter-example provided *does* fail in R2.5.0.

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

Prof Brian Ripley wrote:
> 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) (203.170.234.5)
>>
>>
>> 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).
>
>

-- 
This message has been scanned for viruses and\ dangerous con...{{dropped}}



More information about the R-devel mailing list