[R] summary with names

Thomas Lumley tlumley at u.washington.edu
Thu Oct 16 16:01:50 CEST 2003


On Thu, 16 Oct 2003, 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))}
>
> It works fine, but I don't know which summary corresponds to
> which variable, because the variable names are not printed.
> Can somebody give me a hint?

In this context you will have to print the names yourself.  summary()
doesn't know the names, it only knows the contents of i.

summary(a.data.frame) can print the names becuase the names are part of
the data frame.

As people have already pointed out there are some other strange things
about the command.

	-thomas




More information about the R-help mailing list