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

Anil Maliyekkel amaliy1 at uic.edu
Wed Sep 6 05:50:30 CEST 2006

```On Sep 5, 2006, at 5:54 PM, Thomas Lumley wrote:
> The problem in
>> D = list(ABCD=2:1)
>>  D\$ABC[]<-3:4
>> D
> \$ABCD
>  3 4
>
> \$ABC
>  3 4
>
> is that eval.c:evalseq ends up with a reference to D\$ABCD from
> evaluating D\$ABC with partial matching.  Since evalseq doesn't (and
> shouldn't) increase NAMED on these partially evaluated calls, NAMED
> is still 1 for D\$ABCD.  When evalseq's D\$ABC has 3:4 assigned into
> it the vector is changed directly, since NAMED=1, and both D\$ABC
> and D\$ABCD change.

This problem does not appear when the following is done

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

\$ABC
 3 4

Or when this is done:

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

\$ABC
 3 4

But it does appear when the following is done:

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

\$ABC
 3 4

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

\$ABC
 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"]
[] 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

```