Learn R Programming

DAMisc (version 1.7.2)

sumStats: Summary Statistics

Description

Provides summary statistics (mean, sd, quartiles, IQR, missing n, valid n) for the variables in a data frame.

Usage

sumStats(data, vars, byvar = NULL, convertFactors = TRUE)

Arguments

data

A data frame from which variables will be extracted.

vars

A character vector of variable names.

byvar

A character string giving a variable name of a stratifying variable. The summaries of the vars will be provided for each level of byvar.

convertFactors

Logical indicating whether factors should be converted to numeric first and then summarised.

Value

a vector of summary statistics for each variable or variable-group combination.