Skip to content
Prev 21862 / 63424 Next

(PR#9202) Re: Bugs with partial name matching

On Sep 5, 2006, at 5:54 PM, Thomas Lumley wrote:
This problem does not appear when the following is done

 > D = list(ABCD=2:1)
 > D$ABC[]=c(3,4)
 > D
$ABCD
[1] 2 1

$ABC
[1] 3 4

Or when this is done:

 > D = list(ABCD=2:1)
 > D[["ABC"]][]=3:4
 > D
$ABCD
[1] 2 1

$ABC
[1] 3 4


But it does appear when the following is done:

 > D = list(ABCD=2:1)
 > X = 3:4
 > D$ABC[]=X
 > D
$ABCD
[1] 3 4

$ABC
[1] 3 4

But not when the following is done:
 > D = list(ABCD=2:1)
 > X = 3:4
 > X[1] = 1
 > D$ABC[]=X
 > D
$ABCD
[1] 2 1

$ABC
[1] 1 4

It appears to be a sequence specific bug for the $ operator, which  
might explain why it did not occur with my original examples where I  
had a character data column, but did appear where I had a numeric  
data column that was a sequence.

Going back to the original partial replacement problem, is there  
anyway to turn off partial matching, or to selectively apply exact  
matching when trying to access a single element?  I can get the  
desired single element match using the convoluted syntax D["ABC"] 
[[1]] and perform partial replacement operations on a new column.   
However, it would be nice to have single element access operator that  
does exact matching.

Anil