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

Thomas Lumley tlumley at u.washington.edu
Wed Sep 6 00:22:49 CEST 2006


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




More information about the R-devel mailing list