Skip to contents

This function generates a "Table One", a descriptive summary table frequently used in clinicopathological research manuscripts. It supports multiple output styles for flexible formatting.

Usage

tableone(data, vars, sty = "t1", excl = FALSE)

Arguments

data

The input data as a data frame.

vars

A set of variable names from data to include in the Table One. Supports numeric, ordinal, and categorical variables.

sty

Specify the output style for the descriptive table. 'tableone' provides standard medical format with means/medians and frequencies, 'gtsummary' creates publication-ready descriptive tables, 'arsenal' generates comprehensive descriptive summaries, and 'janitor' produces simple frequency tables for categorical variables.

excl

Boolean option to exclude missing values (NA) from the analysis. Note: Exclusion may remove entire cases.

Value

A results object containing:

results$todoa html
results$summarya html
results$abouta html
results$assumptionsa html
results$tablestyle1a preformatted
results$tablestyle2a html
results$tablestyle3a html
results$tablestyle4a html

Examples

# \donttest{
# Example usage:
# data('histopathology')
# dat <- as.data.frame(histopathology)
# ClinicoPathDescriptives::tableone(
#   data = dat,
#   vars = vars(Sex, PreinvasiveComponent, LVI, PNI, Grade, Age),
#   sty = "t3",
#   excl = TRUE)
# }