sumStatDeluxe: Calculate Custom Summary Statistics

View source: R/sumStatDeluxe.R

sumStatDeluxeR Documentation

Calculate Custom Summary Statistics

Description

This function computes a selection of summary statistics on a data frame which contains response variables and categorical variables. If there is only one response variable, the results are returned in a data frame. For more than one response variable, the results are returned in a list of data frames. See the examples.

Usage

sumStatDeluxe(data = NULL, groupVars = NULL, respVars = NULL, ci = 0.95, ...)

Arguments

data

A data frame containing the variables.

groupVars

Character. A vector of the categorical variable names.

respVars

Character. A vector of the response variable names.

ci

Numeric. The confidence interval desired.

...

Other parameters to be passed downstream.

Value

Either a data frame (one response variable) or a list of data frames (more than one response variable). Each data frame row has summary statistics for a given groupVars. The summary includes the number of observations, the standard deviation and standard error, the mean, and upper and lower confidence intervals.

Examples

require('plyr')

### One response variable returns a data frame:

tst <- sumStatDeluxe(chickwts, groupVars = "feed", respVars = "weight")
tst

### Two response variables returns a list of data frames:

tst <- sumStatDeluxe(iris, groupVars = "Species",
respVars = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"))
tst

### Two categorical variables, one response:

tst <- sumStatDeluxe(warpbreaks, groupVars = c("wool", "tension"), respVars = "breaks")

# One categorical, multiple response variables:

tst <- sumStatDeluxe(airquality, groupVars = "Month",
respVars = c("Ozone", "Solar.R", "Wind"))
tst


bryanhanson/HandyStuff documentation built on July 22, 2022, 6:18 a.m.