[R] Replies on this list [was: removing NA from a data frame]

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Mar 21 13:59:40 CET 2006


François Pinard wrote:

> [Berton Gunter]
> 
>>[Sam Steingold]
> 
> 
>>>PPS. how do I figure out the number of rows in a data.frame?
>>>     is length(attr(X,"row.names")) the right way?
> 
> 
>>help.search("number of rows") immediately gets you your answer!
> 
> 
> Hi, people.  Here, I get:
> 
>   Help files with alias or concept or title matching ‘number of rows’
>   using fuzzy matching:
> 
>   nrow(base)              The Number of Rows/Columns of an Array
> 
> and '?nrow' says that it meant for arrays: nothing about data.frame, and 

Very well about data.frames! ?nrow says in its argument description:

"x a vector, array or data frame "

Uwe Ligges



> not a generic method either.  Even if it was a class method, we should 
> not expect a new user to be very familiar with R (both!) class systems 
> from the start.
> 
> What a new user might think, reading the documentation?   Sam Steingold 
> is surely an experimented and competent computer guy.  He might guess, 
> who knows, that some automatic array to data.frame conversion occurs 
> (all inefficient that it could be).  Yet this would not match other 
> knowledge nor experimentation, as a data.frame is hardly an array:
> 
>   > x = data.frame(a=1:3, b=c(TRUE, TRUE, FALSE), c=letters[1:3])
>   > as.array(x)
>   Erreur dans "dimnames<-.data.frame"(`*tmp*`, value = list(c("a", "b", "c" :
>           'dimnames' incorrect pour ce tableau de données
> 
> Despite help.search("number of rows") provides an answer that happens to 
> be right, it might not be recognised as such by an intelligent reader, 
> and so, it is not really satisfactory.  The documentation for "nrow" 
> could be improved by saying that it applies to any kind of structure for 
> which dim() is meaningful.  And even then, ?dim is silent about data 
> frames.  One clue (yet a pretty weak one) that nrow may be applied to 
> a data.frame comes from the fact that ?dim.data.frame lists the same 
> documentation as ?dim.
> 
> 
> Why do I say all this?  Because it happens, not necessarily in this 
> case, a bit too often nevertheless, that answers given to users are 
> uselessly harsh or haughty.  Especially when they imply that the 
> documentation is perfect.  One problem is that some people enjoy reading 
> such replies.  As example of this strange kind of pleasure, here is 
> a excerpt from R Archives, which I find especially enlightening on the 
> mentality of few members:
> 
>   From: swis at mantrade.com (Steve Wisdom)
>   Date: 2003-12-26 17:04
>   Subject: [R] re| Dr Ward on List protocol 
> 
>   "Andrew C. Ward" <acward at uqconnect.net.au> :
> 
>   >With respect to 'tone' and 'friendliness', perhaps all that is meant or
>   >needed is that people be polite and respectful.
> 
>   >I shake my head as often at rude answers
> 
>   Oh, by gosh, by golly.
> 
>   I don't think an occasional dose of 'real life', via a jab from the
>   Professor, will cause any lasting harm to the cosseted & emolumated students
>   and academics on the List.
> 
>   On a Wall St trading desk, for example, every day one is kicked in the head
>   more brutally by clients, superiors, counterparts, the markets & etc, than
>   ever one would be by the Professor.
> 
>   Plus, the Professor's jabs are good Schadenfreudic fun for the rest of us.
> 
>   Regards,
> 
>   Steve Wisdom
>   Westport CT US
> 
> The truth is that not everybody around here is "cosseted & emolumated 
> students and academics".  Moreover, behaviour at trading desks is fully 
> irrelevant, and for most of us, this is not the kind of life we chose to 
> live.  Wrong behaviour elsewhere is hardly an excuse for not behaving 
> properly, here.
> 
> Moreover, what is mere "good fun" for some may be perceived as highly 
> inelegant by others.  While some competent members may inspire 
> admiration and charism by their knowledge and dedication, they sometimes
> damage beyond repair what they inspire, when showing poor humanity.
> 
> I'm aware of the constant fear some have of seeing this list abused.  
> There are ways for not being abused, which do not require becoming 
> abusive ourselves.  We should deepen such ways in our own habits.
>




More information about the R-help mailing list