[Rd] (PR#9202) Re: Bugs with partial name matching
tlumley at u.washington.edu
Fri Sep 8 18:20:23 CEST 2006
On Tue, 5 Sep 2006, Anil Maliyekkel wrote:
> This problem does not appear when the following is done
> > D = list(ABCD=2:1)
> > D$ABC=c(3,4)
> > D
>  2 1
>  3 4
<other examples snipped>
> 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.
Appearances can be deceptive. The point is that 2:1 and 3:4 are integer
vectors but c(3,4) is a double precision vector. Assigning values of a
different type into a vector requires copying and so masks the bug.
> 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.
It wouldn't fix the bug, and we are running low on symbols that could be
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
More information about the R-devel