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

From: Thomas Lumley <tlumley_at_u.washington.edu>
Date: Tue 05 Sep 2006 - 22:22:49 GMT

The partial matching is fairly deeply built in to complex assignment, another example being
> x<-list(ab=1:2)
> names(x$ab)=c("A","B")
> names(x$a)=c("a","b")
> x

$ab
A B
1 2

$a
a b
1 2

because as evalseq works through the nested calls on the LHS the code being called doesn't know it is in an assignment call.

The bug is a bug. It isn't specific to data frames or to replacing only some elements of a vector
> x<-list(ab=1:2)
> x$a[]<-2:1
> x

$ab
[1] 2 1

$a
[1] 2 1

It also happens when $ is replaced by [[. It looks like a failure to duplicate. A workaround would be not to modify list elements or database columns that don't exist ;).

         -thomas



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed Sep 06 08:29:07 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 06 Sep 2006 - 11:39:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.