[R] Checks for partial matching (was Re: Variable passed to function not used in function in select=... in subset)

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue, 11 Nov 2008 22:27:11 +0000 (GMT)

On Tue, 11 Nov 2008, Duncan Murdoch wrote:

> On 11/11/2008 2:56 PM, Bert Gunter wrote:
>> Ummm... as today is still Armistice day (in my time zone, anyway), maybe
>> we
>> should call a truce and end this flame war...
>
> I haven't seen very many flames -- there have been disagreements, but
> generally it's been quite civil. Certainly I don't think Berwin flamed me.
>
> If we were to add in a warning about partial name matching, it would have to
> be accompanied by some way to deal with common uses like the one Berwin
> mentioned. (There are at least 100 uses of seq(..., length=...) in the core
> & recommended packages. I wouldn't want to fix all of those.) But it could
> still be useful, in the same way the checks for using TRUE and FALSE instead
> of T and F are useful.

Actually we do already have such a check: see ?options (the warnPartial* options). And when I checked a while back did discover and correct a lot of partial matches, about half a dozen or so of which were matching to the wrong thing. From the NEWS for 2.6.0:

     o	New options 'warnPartialMatchDollar', 'warnPartialMatchArgs'
 	and 'warnPartialMatchAttr' to help detect the unintended use
 	of partial matching in $, argument matching and attr()
 	respectively.

I did at that time check if it were possible to change the arg names in seq(), but that horse has bolted since there are methods in public packages using the existing arg sequence.

-- 
Brian D. Ripley,                  ripley_at_stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 11 Nov 2008 - 22:29:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 11 Nov 2008 - 22:30:24 GMT.

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

list of date sections of archive