[R] summary statistics on an entire data frame

From: Patrick Aber <paber_at_tower-research.com>
Date: Fri 11 Aug 2006 - 01:10:35 EST


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@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. Received on Fri Aug 11 01:16:28 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 11 Aug 2006 - 02:22:31 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.