[R] summary with names

Christoph Bier christoph.bier at web.de
Thu Oct 16 19:13:04 CEST 2003


Uwe Ligges schrieb:
> Christoph Bier wrote:
> 
>> Hi,
>>
>> how can I tell 'summary' to print the name of the summarised variable? 
>> This is probably an awkward newbie question but I didn't find an 
>> answer in the Docus, the FAQ and maillist archive.
>>    I want a summary for about 250 variables and realise it the 
>> following way (I know, that I shouldn't use iterations that way in R; 
>> but at the moment it's the easiest way for me):
>>
>> for(i in fb.12.unt[varA1:varZ9]){print (summary(i, na.rm=t))}
> 
> 
> Given fb.12.unt is a list or data.frame,
>   lapply(fb.12.unt, summary, na.rm = TRUE)
> or
>   sapply(fb.12.unt, summary, na.rm = TRUE)
> might do what you want.

Yes, it does :-)! Thanks a lot.

> BTW: "na.rm=t" is wrong anyway ...

Sure, actually I used "na.rm=T" -- but not "TRUE". My alleged
knowledge about this is based on a book about S and S-Plus.
I'm still waiting for "An Introductory in R" as I wrote in a
mail some days ago. I can not read Docus on a monitor, I need
paper in my hand =).

Best regards,

Christoph
-- 
Christoph Bier, Dipl.Oecotroph., Email: bier at wiz.uni-kassel.de
Universitaet Kassel, FG Oekologische Lebensmittelqualitaet und
Ernaehrungskultur \\ Postfach 12 52 \\ 37202 Witzenhausen
Tel.: +49 (0) 55 42 / 98 -17 21, Fax: -17 13




More information about the R-help mailing list