[Rd] Deprecating partial matching in $.data.frame

peter dalgaard pdalgd at gmail.com
Thu Mar 21 14:52:01 CET 2013


On Mar 21, 2013, at 09:25 , Rainer M Krug wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 20/03/13 17:58, Hadley Wickham wrote:
>> On Wed, Mar 20, 2013 at 11:26 AM, peter dalgaard <pdalgd at gmail.com> wrote:
>>> 
>>> On Mar 20, 2013, at 16:59 , William Dunlap wrote:
>>> 
>>>> Will you be doing the same for attribute names?
>>> 
>>> Not at this point.
>> 
>> It would be really nice to have consistent behaviour across argument names, attributes, lists 
>> and data frames, at least for R CMD check.
> 
> I agree with Hadley that consistency is quite important. This is especially true for data.frames
> and lists, as this concerns the data itself, and not names or attributes of the data.

Well, maybe consistency is important, but partial matching never worked for $-extraction in environments, so the current change could be considered mainly a nudge of data frames in the direction of environments. After all, both can be thought of as collections of named objects.

General lists are a somewhat different issue. They often, formally or informally, represent classed objects with a defined set of names, typically obtained as return values from functions. Since the names are known, people will have used the expedient of abbreviating them. This can happen with data frames as well, but less commonly, since it is in general unsafe to rely on column names being uniquely defined by any particular prefix.

I.e., deprecating partial matching for lists opens a rather larger can of worms, and might require more extensive code revisions. Also, the performance hit of a runtime check for partial matching might be more important for lists than it is for data frames. It could be worth it to implement an R CMD check warning as you suggest, but perhaps not just now. 

-Peter

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-devel mailing list