Overall.And.Stratified: Creating Overall and Stratified Tables

View source: R/combine_overall_and_stratified_tables.R

Overall.And.StratifiedR Documentation

Creating Overall and Stratified Tables

Description

This function is designed to create a summary table using lists of continuous and categorical variables (specified). Overall or stratified tables can be constructed or if a stratification variable is included. Additionally, p-values are output using either ANOVA (for continuous variables) or Chi-square (for categorical variables) tests.

Usage

Overall.And.Stratified(
  dataset = dat,
  strata.variable = NULL,
  variables,
  variable.labels = NULL,
  factor.variables = NULL,
  factors_reported.categorical.analyzed.ordinal = NULL,
  exact.variables = NULL,
  exact.variables_detect.and.add.to.list = TRUE,
  categorical.variables_force.exclusion.from.exact.analysis = NULL,
  categorical.variables_report.all.levels = FALSE,
  non.normal.variables = NULL,
  all.patients.row.name = "All Patients",
  descriptors_include = TRUE,
  descriptor_categorical = ", N (%)",
  descriptor_continuous_default = ", Mean (SD)",
  descriptor_continuous_nonnormal = ", Median [Q1,Q3]",
  digits_pvalue = 3,
  digits_categorical = 1,
  digits_continuous = 2,
  missing.data_include.as.list = TRUE,
  missing.data_include.as.separate.table = TRUE,
  missing.data_add.to.table = FALSE,
  missing.data_row.label = "Missing Obs.",
  missing.data_value.prefix = "N="
)

Arguments

dataset

A data.frame object containing, at minimum, all of the variables contained in the table.

strata.variable

= the name of the categorical/pordinal variable that you wish to stratify on. May also be left as NULL for an overall table.

variables

= a vector of the variable names you wish to include as rows in the table.

variable.labels

= an optional vector of labels that will be displayed instead of the variable name, Must be the same length as the variables vector.

factor.variables

= an optional vector of variable names that are numeric but should be coereced into categorical.

factors_reported.categorical.analyzed.ordinal

= an optional vector of variable names where frequencies are reported but the variables are analyzed as ordinal.

exact.variables

= an optional vector of variable names where Fisher's exact should be used.

exact.variables_detect.and.add.to.list

= TRUE/FALSE whether or not to run a chi-square test on the categorical variables and if a warning is produced run Fisher's exact.

categorical.variables_force.exclusion.from.exact.analysis

= an optional vector of variable names that will be coerced into the chi-square test.

categorical.variables_report.all.levels

= if TRUE, then both levels of two-level categorical variables will be reported

non.normal.variables

= an optional vector of variable names where a non-parametric test will be used instead of a t-test/one-way ANOVA.

all.patients.row.name

= a character string that will be displayed in the top row of the table which typically contrains the strata-specific frequencies.

descriptors_include

= TRUE/FALSE to include the statistic description after the variable label in the rows of the table.

descriptor_categorical

= a character string of the descriptor to include after categorical variables.

descriptor_continuous_default

= a character string of the descriptor to include after continuous variables.

descriptor_continuous_nonnormal

= a character string of the descriptor to include after non-normal continuous variables.

digits_pvalue

= a numeric value for the number of digits to report for p-values.

digits_categorical

= a numeric value for the number of digits to report for percentages.

digits_continuous

= a numberic value for the number of digits to report for numeric values.

missing.data_include.as.list

= TRUE/FALSE for whether or not to generate a character string to describe the variables with missing data.

missing.data_include.as.separate.table

= TRUE/FALSE for whether or not to generate a separate table summarizing the variables with missing data.

missing.data_add.to.table

= TRUE/FALSE whether or not to add an additional row below a variable for the purposes of reporting missing values.

missing.data_row.label

= a character string for the row label that will be used for missing data rows

missing.data_value.prefix

= a character string for the pre-fix to include before the missing data frequencies in the body of the table.


UKBiostatCIRCL/UK-Biostat-CIRCL documentation built on June 30, 2022, 4:42 a.m.