table_1: Create a "table 1" from a data.frame

Description Usage Arguments Details Value Examples

Description

Given a factor variable to group on (dimension), this will summarize the other variables terms of that one, and optionally include overall columns with summaries that ignore the dimension groupings. This will not return a ready-to-publish table, but does most of the hard work (the grouped computations).

Usage

1
table_1(df, dimension = NULL, overall = FALSE)

Arguments

df

(data.frame) the data to summarize

dimension

(character) the name of a column in df to use as the dimensions; used to form columns of the output

overall

(logical) should a pair of overall columns be generated?

Details

For each level of dimension, the output will return a count and percentage for each level of other factor variabls, or a mean and standard deviation for the numeric variables. All columns are of type character to preserve formatting.

Value

data.frame with two columns per level of dimension (and two more if overall=TRUE) suffixed by "_count"/"_percent", one row for each numeric column of df, and one row for each level of each non-dimension factor column of df, preceded by the name of that factor column.

Examples

1
2
3

SSW-DataLab/sswdlHelpR documentation built on May 9, 2019, 11:43 a.m.