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)
Run the code above in your browser using DataLab