meanFunc: Format for printing mean (SD) by factor

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/meanFunc.R

Description

Meant to be used in creating R matrix to be exported as a table

Usage

1
meanFunc(data, nvar, gvar = NULL, digits = 1)

Arguments

data

Data frame where nvar and gvar can be found

nvar

Character string of column in data of which means will be calculated

gvar

Character string of column in data of which means will be grouped by

digits

Number of decimals the numbers will be rounded to

Details

na.rm=TRUE is defaulted in the calculation of mean and SD

Value

Returns a string of the format mean (SD) for each of the levels in gvar. If gvar is null then mean (SD) of nvar is provided.

Author(s)

University of Wisconsin-Madison Biostatistics and Medical Informatics Department, Scott Hetzel M.S.

See Also

medianFunc

Examples

1
2
3
4
5
outcome <- rnorm(20)
group <- factor(rep(c("A", "B"), each = 10))
d.frame <- data.frame(outcome, group)

meanFunc(d.frame, "outcome", "group")

jbirstler/biostatrpts documentation built on May 7, 2020, 12:10 a.m.