describe.by {psych}R Documentation

Basic summary statistics by group

Description

Report basic summary statistics by a grouping variable. Useful if the grouping variable is some experimental variable and data are to be aggregated for plotting. Partly a wrapper for by and describe

Usage

describe.by(x, group,mat=FALSE,...)

Arguments

x

a data.frame or matrix

group

a grouping variable or a list of grouping variables

mat

provide a matrix output rather than a list

...

parameters to be passed to describe

Details

To get descriptive statistics for several different grouping variables, make sure that group is a list. In the case of matrix output with multiple grouping variables, the grouping variable values are added to the output.

Value

A data.frame of the relevant statistics broken down by group:
item name
item number
number of valid cases
mean
standard deviation
median
mad: median absolute deviation (from the median)
minimum
maximum
skew
standard error

Author(s)

William Revelle

See Also

describe

Examples

data(sat.act)
describe.by(sat.act,sat.act$gender) #just one grouping variable	
#describe.by(sat.act,list(sat.act$gender,sat.act$education))  #two grouping variables
des.mat <- describe.by(sat.act$age,sat.act$education,mat=TRUE) #matrix  (data.frame) output 
des.mat <- describe.by(sat.act$age,list(sat.act$education,sat.act$gender),mat=TRUE)  #matrix output



[Package psych version 1.2.1 Index]