descriptive.table: Table of Descriptives

Description Usage Arguments Value See Also Examples

View source: R/descriptive.table.R

Description

Table of descriptive statistics, possibly stratified

Usage

1
2
3
4
5
6
7
descriptive.table(vars,
	strata,
	data,
	func.names = c("Mean","St. Deviation","Median",
		"25th Percentile","75th Percentile",
		"Minimum","Maximum","Skew","Kurtosis","Valid N"),
	func.additional)

Arguments

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

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.

See Also

frequencies mean by

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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)

Example output

Loading required package: ggplot2
Loading required package: JGR
Loading required package: rJava
Loading required package: JavaGD

Please type JGR() to launch console. Platform specific launchers (.exe and .app) can also be obtained at http://www.rforge.net/JGR/files/.


Loading required package: car
Loading required package: carData
Loading required package: MASS
Registered S3 methods overwritten by 'lme4':
  method                          from
  cooks.distance.influence.merMod car 
  influence.merMod                car 
  dfbeta.influence.merMod         car 
  dfbetas.influence.merMod        car 


Note Non-JGR console detected:
	Deducer is best used from within JGR (http://jgr.markushelbig.org/).
	To Bring up GUI dialogs, type deducer().

$`strata: all cases `
         Mean St. Deviation Valid N
mpg  20.09062      6.026948      32
hp  146.68750     68.562868      32

$`cyl: 4 `
        Mean St. Deviation Valid N
mpg 26.66364      4.509828      11
hp  82.63636     20.934530      11

$`cyl: 6 `
         Mean St. Deviation Valid N
mpg  19.74286      1.453567       7
hp  122.28571     24.260491       7

$`cyl: 8 `
        Mean St. Deviation Valid N
mpg  15.1000      2.560048      14
hp  209.2143     50.976886      14

$`cyl: 4 `
        Mean St. Deviation Valid N mean.deviance
mpg 26.66364      4.509828      11      3.833058
hp  82.63636     20.934530      11     18.578512

$`cyl: 6 `
         Mean St. Deviation Valid N mean.deviance
mpg  19.74286      1.453567       7      1.191837
hp  122.28571     24.260491       7     15.469388

$`cyl: 8 `
        Mean St. Deviation Valid N mean.deviance
mpg  15.1000      2.560048      14      1.785714
hp  209.2143     50.976886      14     39.816327

Deducer documentation built on May 2, 2019, 8:35 a.m.