make_table1: Make a Table 1

Description Usage Arguments Details Value Examples

View source: R/tables.R

Description

This function provides a wrapper around table1::table1 that allows it to create a column for P-values and perform the appropriate statistical tests. It also adds functionality for captions and table numbering.

Usage

1
make_table1(df, group, ..., negative_label = "No", caption, table_num)

Arguments

df

a dataframe

group

a group to split the columns by. Must be a logical or a factor with two levels.

...

a list of columns to be included in the table

negative_label

a word to prepend to the label of the negative group (see example)

caption

an optional caption

table_num

an optional table number

Details

Currently only works if you intend to split by the variable group, which must be a logical or a factor with two levels.

Value

an HTML table

Examples

1
2
3
4
5
6
7
8
9
diamonds <- ggplot2::diamonds
diamonds$expensive <- diamonds$price > 500
Hmisc::label(diamonds$depth) <- "Depth"
Hmisc::label(diamonds$table) <- "Table"
Hmisc::label(diamonds$price) <- "Price"
Hmisc::label(diamonds$clarity) <- "Clarity"
Hmisc::label(diamonds$cut) <- "Cut"
Hmisc::label(diamonds$expensive) <- "Expensive"
diamonds %>% make_table1(group = expensive, depth, clarity, cut, negative_label = "Not")

dylanrussellmd/nsqipBileSpill documentation built on Dec. 20, 2021, 2:17 a.m.