Learn R Programming

prettyR (version 1.0-4)

brkdn: Breakdown of a numeric variable by grouping variable(s)

Description

Calculates means, variances and ns for subgroups of numeric observations and displays the results.

Usage

brkdn(formula,dataframe,maxlevels=10,do.sd=FALSE)

Arguments

formula
a formula with the variable to be broken down on the left and the names of one or more variables defining subgroups on the right
dataframe
the data frame from which to select the variables
maxlevels
the maximum number of levels in any subgroup
do.sd
logical - whether to return standard deviations instead of variances

Value

  • The results of dstats, or a multi-level list if more than one grouping variable is specified.

Details

brkdn will accept a formula referring to columns in a data frame. It calls dstats for the calculations and displays a table of results.

See Also

dstats

Examples

Run this code
test.df<-data.frame(Age=rnorm(100)+3*10,Sex=sample(c("M","F"),100,TRUE),
  Employ=sample(c("FT","PT","NO"),100,TRUE))
 brkdn(Age~Sex+Employ,test.df)

Run the code above in your browser using DataLab