From tlumley at u.washington.edu  Wed Sep  6 00:22:49 2006
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Tue, 5 Sep 2006 15:22:49 -0700 (PDT)
Subject: [Rd] (PR#9202) Re: Bugs with partial name matching during partial
In-Reply-To: <20060905014002.634C928F8E@slim.kubism.ku.dk>
References: <20060905014002.634C928F8E@slim.kubism.ku.dk>
Message-ID: <Pine.LNX.4.64.0609051507530.17674@homer23.u.washington.edu>


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




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