[R] summary statistics on an entire data frame

Petr Pikal petr.pikal at precheza.cz
Thu Aug 10 17:37:59 CEST 2006

data frame is list so

mean(unlist(DF)) or sd(unlist(df))

shall do what you want if I understood correctly.


On 10 Aug 2006 at 11:10, Patrick Aber wrote:

From:           	"Patrick Aber" <paber at tower-research.com>
To:             	<r-help at stat.math.ethz.ch>
Date sent:      	Thu, 10 Aug 2006 11:10:35 -0400
Subject:        	[R] summary statistics on an entire data frame

> Hello,
> I am wondering how to compute functions like mean(), sd(), etc. on a
> data frame, but instead of getting a vector with the summary stat
> calculated individually for each column, get one number for the whole
> data set.  I have noticed that coercing the frame to a time series
> (ts) gives the desired result for certain functions, but not others. 
> mean() gives a single numeric result, but sd() still gives standard
> deviations per column.  I have noticed that when my data is coerced to
> a ts, it actually gets the class c("mts", ts") instead of just "ts",
> which may or may not have something to do with the problem.
> Thanks for any help you can give!
>  [[alternative HTML version deleted]]
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html and provide commented,
> minimal, self-contained, reproducible code.

Petr Pikal
petr.pikal at precheza.cz

More information about the R-help mailing list