descriptive.table {Deducer} | R Documentation |
Table of descriptive statistics, possibly stratified
descriptive.table(vars,
strata,
data,
func.names = c("Mean","St. Deviation","Median",
"25th Percentile","75th Percentile",
"Minimum","Maximum","Skew","Kurtosis","Valid N"),
func.additional)
vars |
A variable or data.frame containing variables on which to run descriptive statistics. |
data |
The data frame in which vars is evaluated |
strata |
A variable or data.frame containing variables on which to stratify |
func.names |
A character vector of built-in statistics |
func.additional |
A named list of functions. Each function should take a numeric vector as its argument, and return a single value |
Returns a list of matrix
objects containing descriptive information on all variables in dat
.
One for each level or combination of levels in strata
.
data(mtcars)
##means and standard deviations
descriptive.table(vars = d(mpg,hp),data= mtcars,
func.names =c("Mean","St. Deviation","Valid N"))
##stratifying by cyl
descriptive.table(vars = d(mpg,hp) ,
strata = d(cyl),data= mtcars,
func.names =c("Mean","St. Deviation","Valid N"))
func.list=list(mean.deviance=function(x) mean(abs(x-mean(x))))
##Adding deviance as a statistic
descriptive.table(vars = d(mpg,hp) ,
strata = d(cyl),data= mtcars,
func.names =c("Mean","St. Deviation","Valid N"),func.additional=func.list)