Mihai Nica wrote:

Greetings:

I would like to make a table with descriptive statistics for a data.frame. I guess the 
question is how can I put together, in a table, the results from, say:

apply(df, 2, mean, na.rm =T)
apply(df, 2, median, na.rm =T)
.......

Thanks,

Mihai Nica
Jackson State University
155 B Parkhurst Dr.
Jackson, MS 39202
601 969 5423
601 914 0361
        [[alternative HTML version deleted]]

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




Apart from Uwe's advice of reading summary.data.frame,
here is a very simple version:

> test <- data.frame(x=rnorm(100), y=rnorm(100), z=rnorm(100))
> sapply(test, function(x) {
           res <- c(mean(x), median(x), mad(x), sd(x))
           names(res) <- c("mean","median","mad","sd")
           res}
 )
              x          y           z
mean   0.2159557 0.01684044 -0.05950480
median 0.1123084 0.13149150  0.01451704
mad    1.0054574 0.91742137  1.16986352
sd     0.8999813 0.98771362  1.02901577

Kjetil

--

Kjetil Halvorsen.

Peace is the most effective weapon of mass construction.
              --  Mahdi Elmandjra

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to