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

Tony Plate tplate at blackmesacapital.com
Fri Sep 8 22:21:20 CEST 2006

Anil Maliyekkel wrote:
> [snip]
> 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"] 
> [[1]] and perform partial replacement operations on a new column.   
> However, it would be nice to have single element access operator that  
> does exact matching.

The easiest thing to do is probably to always supply full names, and if 
you want to create a new component, then create it in its entirity (not 
by assigning to a subset of a non-existent component).

A couple of years ago I proposed (with code) an operator '$$' that did 
only exact matching, but that proposal didn't gather any interest at the 
time.  It might actually make more sense to have the roles switched, so 
that the ordinary '$' required exact matches, while the special '$$' 
allowed partial matching (to allow for convenient interactive use). 
But, that's probably a bigger change than the R code base & community 
could bear.

Then again, what about the following as a way forward to eliminating 
partial matching on names for "$" and "[[":

(1) Announce that partial matching for "$" and "[[" is deprecated

(1a) (optional) Introduce "$$" operator with partial matching, intended 
solely for interactive use, with QA checks to ensure that it is not used 
in packages

(2) Introduce warnings upon use of partial matching with "$" and "[[", 
with an option() to turn them off.  Initially these warnings are off by 
default, but QA tools turn them on, and package maintainers see the 

(3) After a year or two (assuming most packages no longer contain use of 
partial matching), change the default warning about partial matching to 

(4) After another year, eliminate partial matching with "$" and "[[".


-- Tony Plate

> Anil
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

More information about the R-devel mailing list