Try this function:

> #create some data
> x <- data.frame(a=runif(100), b=runif(100,100,200),
c=runif(100,1000,2000))
> # need to transpose the output of sapply
> t(sapply(x, function(z){
+     .res <- c(quantile(z, c(0, .25, .5, .75, 1)), mean(z), var(z))
+     names(.res) <- c('Min', '1st Qu', 'Median', '3rd Qu', 'Max', 'Mean',
'Var')
+     .res
+     }
+ ))
           Min       1st Qu       Median       3rd Qu         Max
Mean          Var
a 8.147703e-03    0.2477605    0.5365074    0.7644615    0.995281
0.5142281 8.596908e-02
b 1.000605e+02  122.9294392  147.0742970  176.0785627  199.484326
147.9730000 9.092492e+02
c 1.010171e+03 1173.8183349 1498.1997677 1719.2519408 1996.363311
1467.8446420 8.932657e+04
>



On 7/3/06, zhijie zhang <epistat@gmail.com> wrote:
>
> Dear friends,
> summary() doesn't give a good ouput style,e.g.:
> grass            soiltem          airtem         gheight
> humidity      altitude
> diluo      :38   Min.   :15.90   Min.   :17.70   Min.   : 8.00   Min.   :
> 0.2360   high: 43
> huanghuacai:32   1st Qu.:19.32   1st Qu.:22.60   1st Qu.:40.00   1st Qu.:
> 0.3190   low :119
> hucao      :46   Median :20.20   Median :25.30   Median :60.00   Median :
> 0.3399
> yuhao      :46   Mean   :20.52   Mean   :26.43   Mean   :51.93   Mean   :
> 0.3423
>                  3rd Qu.:21.48   3rd Qu.:29.73   3rd Qu.:70.00   3rd Qu.:
> 0.3627
>                  Max.   :28.60   Max.   :42.10   Max.   :90.00   Max.   :
> 0.4453
>
> could i get a result like the following: colums are statistical indices
> and
> the rows are variables
>
> *            min  1st Qu. Median Mean 3rd Qu. Max. variance
> grass*
> *soiltem *
> *airtem*
> which could be copy and used in the papers easily?
> Thanks very much!
> --
> Kind Regards,
> Zhi Jie,Zhang ,PHD
> Department of Epidemiology
> School of Public Health
> Fudan University
> Tel:86-21-54237149
>
>        [[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
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390 (Cell)
+1 513 247 0281 (Home)

What is the problem you are trying to solve?

	[[alternative HTML version deleted]]

