tibble_one: Tidy characteristics data

Description Usage Arguments Value Examples

View source: R/tibble_one.R

Description

Tidy characteristics data

Usage

1
2
3
4
tibble_one(data, meta_data = NULL, formula = NULL, row_vars = NULL,
  strat = NULL, by = NULL, specs_table_vals = NULL,
  specs_table_tests = NULL, expand_binary_catgs = FALSE,
  include_pval = FALSE, include_freq = FALSE)

Arguments

data

a data frame

meta_data

a meta data frame. If unspecified, a meta data frame will be created using data.

formula

an optional formula object. The left hand side of the formula should be blank. The right hand side of the formula should contain row variables for the table. The '|' symbol can be used to include stratifying variables. If this option is used, no more than two stratifying variables should be used, and they must be separated by a * symbol. If formula is used, the strat, by, and row_vars inputs are ignored.

row_vars

a character vector indicating column names of row variables in the table. If unspecified, all columns are used.

strat

a character value indicating the column name in data that will be used to stratify the table

by

a character value indicating the column name in data that will be used to split the table into groups, prior to stratification.

specs_table_vals

named vector of character values. Names should be variables, while values should be specs. Valid specs are 'mean' and 'median' (see examples).

specs_table_tests

named vector of character values. Names should be variables, while values should be specs. Valid specs are 'params' or 'noparm' (see examples).

expand_binary_catgs

T/F, should all categories be included for binary categorical variables? (This only applies to binary variables.)

include_pval

T/F, should the table include a column for p-values? If p-values are included, factor variables are handled using chi-square tests, continuous variables are handled using t-tests or ANOVA, depending on the number of categories in the table stratification.

include_freq

T/F, should frequency values be included for categorical variables?

Value

a tibble containing summary values that describe characteristics of observations in data.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data("pbc_tbl1")
# report median albumin instead of mean
# use kruskal wallis test for albumin
tibble_one(
  pbc_tbl1,
  formula = ~ . | trt,
  include_freq = FALSE,
  include_pval = TRUE,
  specs_table_vals = c(albumin = 'median'),
  specs_table_tests = c(albumin = 'nopars')
)

bcjaeger/KableOne documentation built on Oct. 16, 2019, 12:26 p.m.