numSummary: Summary Statistics for Numeric Variables

Description Usage Arguments Value Author(s) See Also Examples

View source: R/numSummary.R

Description

numSummary creates neatly formatted tables of means, standard deviations, coefficients of variation, skewness, kurtosis, and quantiles of numeric variables.

Usage

1
2
3
4
5
6
7
8
numSummary(data, 
	statistics=c("mean", "sd", "se(mean)", "IQR", 
        "quantiles", "cv", "skewness", "kurtosis"),
	type=c("2", "1", "3"),
    quantiles=c(0, .25, .5, .75, 1), groups)
    
## S3 method for class 'numSummary'
print(x, ...)

Arguments

data

a numeric vector, matrix, or data frame.

statistics

any of "mean", "sd", "se(mean)", "quantiles", "cv" (coefficient of variation — sd/mean), "skewness", or "kurtosis", defaulting to c("mean", "sd", "quantiles", "IQR").

type

definition to use in computing skewness and kurtosis; see the skewness and kurtosis functions in the e1071 package. The default is "2".

quantiles

quantiles to report; default is c(0, 0.25, 0.5, 0.75, 1).

groups

optional variable, typically a factor, to be used to partition the data.

x

object of class "numSummary" to print.

...

arguments to pass down from the print method.

Value

numSummary returns an object of class "numSummary" containing the table of statistics to be reported along with information on missing data, if there are any.

Author(s)

John Fox [email protected]

See Also

mean, sd, quantile, skewness, kurtosis.

Examples

1
2
3
4
5
6
7
8
if (require("car")){
    data(Prestige)
    Prestige[1, "income"] <- NA
    print(numSummary(Prestige[,c("income", "education")], 
    	statistics=c("mean", "sd", "quantiles", "cv", "skewness", "kurtosis")))
    print(numSummary(Prestige[,c("income", "education")], groups=Prestige$type))
    remove(Prestige)
}

Example output

Loading required package: car
Loading required package: sandwich
                mean          sd        cv  skewness   kurtosis     0%      25%
income    6742.92079 4230.450564 0.6273914 2.2565718  7.2046866 611.00 4075.000
education   10.73804    2.728444 0.2540915 0.3345254 -0.9782158   6.38    8.445
              50%       75%     100%   n NA
income    5902.00 8131.0000 25879.00 101  1
education   10.54   12.6475    15.97 102  0

Variable: income 
          mean       sd     IQR   0%     25%    50%      75%  100%  n NA
bc    5374.136 2004.330 2892.75 1656 3836.75 5216.5  6729.50  8895 44  0
prof 10499.733 5505.145 5687.50 4614 6516.75 8645.0 12204.25 25879 30  1
wc    5052.304 1944.325 3175.50 2448 3450.00 4741.0  6625.50  8780 23  0

Variable: education 
          mean        sd    IQR    0%    25%   50%     75%  100%  n NA
bc    8.359318 1.1648343 1.3525  6.38  7.570  8.35  8.9225 10.93 44  0
prof 14.084194 1.3940248 2.2100 11.09 12.940 14.44 15.1500 15.97 31  0
wc   11.021739 0.9233076 0.8850  9.17 10.575 11.13 11.4600 12.79 23  0

RcmdrMisc documentation built on April 2, 2018, 5:04 p.m.