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

From: Tony Plate <>
Date: Fri 08 Sep 2006 - 20:21:20 GMT

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 warnings.

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

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


> Anil
> ______________________________________________
> mailing list
> mailing list Received on Sat Sep 09 06:23:06 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 Sat 09 Sep 2006 - 00:30:05 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.