[R] "[.data.frame" and lapply

Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Mon Mar 30 11:56:56 CEST 2009


> Bert Gunter wrote:
>   
>> "Note that these operations do not match their index arguments in the
>> standard way: argument names are ignored and positional matching only is
>> used. So m[j=2,i=1] is equivalent to m[2,1] and not to m[1,2]. "
>>
>> ## Note that the next lines immediately following say:
>>
>> "This may not be true for methods defined for them; for example it is not
>> true for the data.frame methods described in [.data.frame. 
>>
>> To avoid confusion, do not name index arguments (but drop and exact must be
>> named). "
>>
>> So, while it may be fair to characterize the md[,i=3] as a design flaw, it
>> is both explicitly pointed out and warned against. Note that,of course
>>
>> md[,3]
>> ## 3rd column, good practice
>> md[,j=3]
>> ## also 3rd column .. but warned against as bad practice
>>
>> Whether a behavior should be considered a "bug" if it is explicitly warned
>> against in the docs, I leave for others to decide. Too deep for me. 
>>     

in my humble opinion, if the above (and the previously discussed) is
neither a bug nor a design flaw, then it must be an intentional
misfeature designed specifically to confuse users.  have your take.

vQ




More information about the R-help mailing list