Re: [Rd] 'merge' function: behavior w.r.t. NAs in the key column

2008-03-19 Thread Bill Dunlap
On Wed, 19 Mar 2008, Prof Brian Ripley wrote: > merge() in R behaves in exactly the same way as match() (which it uses), > and not as Mr Anders claims is 'the convention'. (Note that == and match > are not the same concept, nor is 'identical'.) Splus's merge works more like x.key==y.key (or matc

Re: [Rd] 'merge' function: behavior w.r.t. NAs in the key column

2008-03-19 Thread Prof Brian Ripley
merge() in R behaves in exactly the same way as match() (which it uses), and not as Mr Anders claims is 'the convention'. (Note that == and match are not the same concept, nor is 'identical'.) This was discussed at length for match() some years ago (AFAIR when NA xharacter strings were formali

Re: [Rd] 'merge' function: behavior w.r.t. NAs in the key column

2008-03-19 Thread Simon Anders
Hi Bill, Bill Dunlap wrote: > Splus (versions 8.0, 7.0, and 6.2) gives: >> merge( x, y, by="key" ) > key val.x val.y >1 21222 >2 31323 >3 31423 >4 31326 >5 31426 > Is that what you expect? There is no argument > to Spl

Re: [Rd] 'merge' function: behavior w.r.t. NAs in the key column

2008-03-14 Thread Bill Dunlap
On Fri, 14 Mar 2008, Simon Anders wrote: > I recently ran into a problem with 'merge' that stems from the way how > missing values in the key column (i.e., the column specified > in the "by" argument) are handled. I wonder whether the current behavior > is fully consistent. > ... > > x <- data.fra

[Rd] 'merge' function: behavior w.r.t. NAs in the key column

2008-03-14 Thread Simon Anders
Hi, I recently ran into a problem with 'merge' that stems from the way how missing values in the key column (i.e., the column specified in the "by" argument) are handled. I wonder whether the current behavior is fully consistent. Please have a look at this example: > x <- data.frame( key = c(1