[R] summary statistics

William Revelle lists at revelle.net
Tue Feb 10 03:06:24 CET 2009


At 6:41 PM -0500 2/9/09, David Winsemius wrote:
>describe() in Hmisc provides much of the rest of what you asked for:
>
>>  describe(pref900$TCHDL)
>pref900$TCHDL
>       n missing  unique    Mean     .05     .10     .25     .50 
>.75     .90     .95
>  906190    4469   16051   4.123   2.320   2.557   3.061   3.841   
>4.886   6.054   6.867
>
>lowest :  0.9342  1.0200  1.0522  1.1008  1.1061, highest: 19.8696 
>20.1667 20.7619 21.6364 21.7200
>

As does describe in the psych package

describe(sat.act)
>  describe(sat.act)
           var   n   mean     sd median trimmed    mad min max range 
skew kurtosis   se
gender      1 700   1.65   0.48      2    1.68   0.00   1   2     1 
-0.61    -1.62 0.02
education   2 700   3.16   1.43      3    3.31   1.48   0   5     5 
-0.68    -0.07 0.05
age         3 700  25.59   9.50     22   23.86   5.93  13  65    52 
1.64     2.42 0.36
ACT         4 700  28.55   4.82     29   28.84   4.45   3  36    33 
-0.66     0.53 0.18
SATV        5 700 612.23 112.90    620  619.45 118.61 200 800   600 
-0.64     0.33 4.27
SATQ        6 687 610.22 115.64    620  617.25 118.61 200 800   600 
-0.59    -0.02 4.41

see also describe.by to break this down by some grouping variable.

Bill




>On Feb 9, 2009, at 6:04 PM, phoebe kong wrote:
>
>>Hi all,
>>
>>I'm wondering if there is a function that can return summary statistics:
>>N=total number of observation, # missing, mean, median, range, standard
>>deviation.
>>
>>As I know, summary() returns some of info I've mentioned above.
>>
>>Thanks,
>>SY
>>
>>	[[alternative HTML version deleted]]
>>
>>______________________________________________
>>R-help at r-project.org 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.
>
>______________________________________________
>R-help at r-project.org 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.


-- 
William Revelle		http://personality-project.org/revelle.html
Professor			http://personality-project.org/personality.html
Department of Psychology             http://www.wcas.northwestern.edu/psych/
Northwestern University	http://www.northwestern.edu/
Use R for psychology                       http://personality-project.org/r




More information about the R-help mailing list