TernTables-package: TernTables: Automated Statistics and Table Generation for...

TernTables-packageR Documentation

TernTables: Automated Statistics and Table Generation for Clinical Research

Description

TernTables generates publication-ready summary tables for descriptive statistics and group comparisons. It automatically detects variable types (continuous, binary, or categorical), selects appropriate statistical tests, and formats results for direct export to Word or Excel. Numeric variables can be designated as ordinal via force_ordinal.

Main functions

ternG

Grouped comparison table for 2- or 3-level group variables.

ternD

Descriptive-only summary table (no grouping).

word_export

Export a TernTables tibble to a formatted Word document.

write_methods_doc

Generate a methods Word document describing tests used.

val_p_format

Format a P value for publication.

val_format

Format a numeric value with rounding rules.

Statistical tests applied

Continuous (2 groups)

Welch's t-test or Wilcoxon rank-sum, routed by ROBUST logic.

Continuous (3+ groups)

Welch ANOVA or Kruskal-Wallis, routed by ROBUST logic per group.

Binary / Categorical

Chi-squared or Fisher's exact, based on expected cell counts.

Ordinal (forced)

Wilcoxon rank-sum (2 groups) or Kruskal-Wallis (3+ groups).

ROBUST routing uses four gates: (1) n < 3 \Rightarrow non-parametric (fail-safe); (2) |skewness| > 2 in any group \Rightarrow non-parametric; (3) all groups n \geq 30 \Rightarrow parametric (CLT); (4) otherwise Shapiro-Wilk p > 0.05 in all groups \Rightarrow parametric.

Getting started

See vignette("getting-started", package = "TernTables") for a walkthrough using the bundled tern_colon dataset.

Web application

TernTables is available as a free point-and-click web application at https://tern-tables.com/ — no R installation required. Upload a CSV or XLSX file, configure the analysis through a simple interface, and download a publication-ready Word table. The web application is powered by this R package; all statistical methods and outputs are identical to calling ternG(), ternD(), and ternP() directly.

Author(s)

Maintainer: Joshua D. Preston joshua.preston@emory.edu (ORCID)

Authors:

See Also

Useful links:


TernTables documentation built on March 26, 2026, 5:09 p.m.