medianFunc: Format for printing median (IQR) or (Range) by factor

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

View source: R/medianFunc.R

Description

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

Usage

1
medianFunc(data, nvar, gvar = NULL, digits = 1, IQR = TRUE)

Arguments

data

Data frame where nvar and gvar can be found

nvar

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

gvar

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

digits

Number of decimals the numbers will be rounded to

IQR

Logical: If TRUE then median (IQR) is printed. If FALSE then median (range) is printed

Details

na.rm=TRUE is defaulted in the calculation of median and IQR or min and max

Value

Returns a string of the format median (IQR or range) for each of the levels in gvar. If gvar is null then median (IQR or range) is returned for nvar.

Author(s)

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

See Also

meanFunc

Examples

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

medianFunc(d.frame, "outcome", "group", IQR = FALSE)

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