Beginner-Friendly Statistics and Publication-Ready Tables
Overview
Provides beginner-friendly functions for common descriptive and inferential statistical analyses, together with tools for creating publication-ready tables. The package includes data description, summary statistics, distribution assessment, group comparisons, effect sizes, correlations, proportions and rates with confidence intervals, crosstabs for epidemiological measures, plots, and modular table-building workflows. Statistical methods include unequal-variance comparisons described by Welch (1947) doi:10.1093/biomet/34.1-2.28, score confidence intervals described by Wilson (1927) doi:10.1080/01621459.1927.10502953, and robust variance assessment described by Brown and Forsythe (1974) doi:10.1080/01621459.1974.10482955.
save_output()no longer writes a bare filename implicitly to the current working directory. Supplypathexplicitly (usetempdir()for temporary output) or provide a filename that includes its destination directory. This prevents accidental writes to a user's working or package directory.- Added
missing = "as_category"tosummary_table()andadd_summary(). For categorical variables, missing values are displayed as a category and included in percentage denominators. The existing"ifany","always", and"no"settings retain non-missing denominators. Continuous missingness remains a separate row, and missing values are never silently recoded as a non-event. - Synchronised the README, app manual, function-options material, styling and export guide, GUI wording, and pkgdown navigation around the three distinct table routes:
summary_table()for participant-level data,epi_table()for outbreak/surveillance calculations, and value-preservingas_stats_table()for final results calculated elsewhere.
Show all changes in 1.0.0Hide the rest of the changes in 1.0.0
- Finalised the pre-CRAN presentation API.
add_summary()now uses onestatisticargument and leaves confidence intervals exclusively toadd_ci(). Removed development-only no-opdigitsandpvalue_stylecontrols fromto_gt()andsave_output(); working p-value styling remains available throughcustomise_table(). - Removed the hidden internal
...interface fromcompare_groups(). Package layers now call a private comparison engine while the public function has a fully explicit, documented signature. - Added explicit
statistic = "mean_se"support. It is never selected automatically because SE describes precision of the estimated mean rather than variability among observations. summary_table()now returns the engine-neutralgtstats_summaryclass. Useto_gt()orto_flextable()for explicit rendering.- Standardised
add_p(test = ...)withcompare_groups(test = ...)and retired the development-onlymethodspelling for inferential test choice. - Retired the redundant
tbl_stats()renderer and development-onlysummary_table(mode = "rate")route. Useto_gt()and add rates withadd_rate(). - Added two real, traceable CDC teaching datasets:
outbreak_data, the classic Oswego foodborne-outbreak line list, andsurveillance_data, an archived weekly hospital-admission surveillance extract. They demonstrate the line-list and aggregate routes ofepi_table()and include explicit source, transformation, and reuse documentation. summary_table()gainsoverall_categorical. Automatic mode shows counts in the Overall column when grouped cells use row percentages; users can explicitly request n (%), n/N (%), counts, or percentages.add_ci()now acceptsas_stats_table()results and calculates confidence intervals from explicitly mapped aggregate columns for proportions, rates, means, or estimates with standard errors. Statistical meaning is never guessed from column names.- Added
as_stats_table()to format, customise, and export an already summarised data frame without recalculating its values. - The GUI can now select a data frame from the current R environment and can send already summarised data directly to the table customiser.
- Added
show_dichotomous = "single_row"with optional namedvaluechoices tosummary_table()andadd_summary(). This matches gtregression and gives conventional one-event-per-row binary summaries without changing full-variable inference. - Replaced the Summary-table app's hidden text mapping for compact binary summaries with an explicit event-level selector for every selected binary variable. Switching between one event row and all levels now produces a visible, reproducible change in both the table and generated R code.
- Reduced publication footnote type in flextable and gt output, and exposed the binary display and advanced styling choices in the gtstats app.
- Made publication output Office-first: supported results now print as
flextableobjects by default.to_gt()provides an explicit HTML-focused route. The redundant development renderer alias was retired; useto_gt().save_output()now accepts raw gtstats results, flextables and gt tables and supports PPTX. - Extended
customise_table()with spanning headers, additional or suppressed footnotes, journal-ready border and density controls, named column widths, and configurable p-value styling. Its default engine is now"flextable"; useengine = "gt"when that output is required. - Continuous summary overrides now support a global fallback plus exceptions, for example
statistic = c(continuous = "mean_sd", lwt = "median_iqr"). The deliberate variable-selection model is retained: an empty builder now directs beginners toinclude = c(age, sex, bmi)orinclude = everything(). - Redesigned the Summary table workflow as a progressive, layer-by-layer API.
summary_table()builds the descriptive foundation; the newadd_ci()layer adds confidence intervals globally or to selected variables;add_p()adds comparisons; and specialist rows remain explicit optional ingredients. The Shiny app now mirrors the same sequence and generates the corresponding reproducible pipeline. - Simplified
add_proportion()defaults so its display, layout, confidence settings and precision inherit from the parent table. It is now documented as a selected-event highlight rather than the route for adding CIs to ordinary categorical summaries. - Tightened summary-table presentation: missing-value rows now remain inside the correct variable block and are emitted once per variable. A requested
layout = "separate"no longer creates empty CI columns before a CI layer is added. Compact cells and separate-column headers avoid repeating the confidence level; the level and interval method are stated once in the publication footnote. - Separate CI layouts now use context-aware estimate headers (
n (%),Mean (SD),Median (IQR), orSummary) and an explicit confidence-level header such as95% CI. Categorical-only tables without intervals can usecategorical_layout = "separate"to display n and % in distinct columns. - Redesigned the GUI Summary workspace as a recipe. Users can now build an ordinary summary or rate table and add total, selected-proportion, rate, custom-row and p-value ingredients with their relevant options. Compact and separate-column layouts are available at table creation, and generated code reproduces the complete builder pipeline.
- Simplified
add_proportion()footnotes in summary tables. Publication output no longer repeats the selected event or explains internaladd_p()behavior; when confidence intervals are shown, only their level and method are noted. - Completed the GUI plotting workflow. Distribution assessments now expose histogram, density, Q-Q and boxplot diagnostics; group comparisons expose
plot_compare()controls; and correlation plots expose labels, confidence level, typography and colour controls. Every plot is downloadable as PNG or PDF and represented in the generated reproducible R code. - Added a dedicated **Customise table** workspace immediately after Summary table in
gtstats_app(), matching the post-processing workflow in the gtregression app. The latest Summary table is carried forward and displayed automatically. Users can relabel columns, rows and levels, change titles, notes and styling, hide columns, download the result, and copy reproduciblecustomise_table()code without altering the underlying statistics. crosstabs(format = "tibble")now returns plain console-friendly cells such as86 (66.15%)instead of HTML line-break markup. The default publication table retains its stacked cell layout.add_p()now accepts tidy-selectinclude, allowing variables to remain in a descriptive table without receiving an inappropriate p-value. The GUI exposes the same control as **Do not test** and reproduces it in generated R code. Birth-weight examples now avoid testingbwtagainst the category derived frombwt.- Finalised the pre-CRAN comparison API:
effect_size()andplot_compare()now usevariableandgroup, matchingcompare_groups().add_p()now calls its marked-skewness optiondistribution_check, replacing the misleadingnormality_checkname. - Automatic
"recommended"continuous summaries are now resolved once per variable across all displayed groups, preventing a Table 1 from mixing mean (SD) and median (IQR) for the same variable. Categorical confidence intervals now use Wilson intervals by default, withci_method = "exact"available. - Simulated Fisher exact tests for larger contingency tables are reproducible by default via
fisher_seed = 1049and preserve the caller's RNG state. - Repeated-measures ANOVA now reports a Greenhouse-Geisser-corrected p-value and diagnostics.
plot_compare()now supports repeated continuous and paired categorical displays and exposes the same repeated-test choices ascompare_groups(). - Redesigned
gtstats_app()around a safer end-to-end workflow. Original data now remain the active analysis dataset until prepared data are explicitly chosen; Data Prep can set publication display labels; and Table 1 is now named Summary table. The summary builder provides per-variable descriptive and inferential choices, live table styling, matching export output, and copy/download access to both analysis code and the complete session script. - Replaced the Summary table's expanding per-variable dropdown grid with two validated override editors. Unlisted continuous variables use Recommended; unlisted tests use Auto. Users enter only exceptions as
variable = option, can usenoneto suppress a test, receive live validation and examples, and obtain matching named-vector R code. - Organised the app's Summary table controls into four numbered sections: contents, summaries, statistical comparisons, and appearance. Advanced Auto settings and cosmetic options are collapsed until needed.
mean_cicells now show the estimate and interval without repeating "95% CI" in every cell; the confidence level remains clearly defined in the relevant footnote. - Extended
correlation()with a multi-variable matrix route viavars. Matrix output uses one transparent Pearson or Spearman method throughout, retains pairwise denominators and adjusted p-values in tidy$summary, and supports lower, upper or full publication layouts.plot_correlation()now visualises these results as a labelled coefficient heatmap. - Correlation matrices can now preserve input order, sort labels alphabetically, or use correlation-based clustering; users can hide the diagonal and include pairwise n alone or alongside adjusted p-values in each cell. Matrix heatmaps inherit the selected triangle and diagonal settings.
- The app now includes a complete Correlation workspace for pair and matrix analyses, with checkbox variable selection, matrix layout and ordering, cell-content and multiplicity controls, table/heatmap previews, Audit tabs, downloadable tables and plots, and reproducible analysis/plot code. It also provides tidy CSV export, a selected-variable counter, large-matrix guidance, a visible warning when pairwise denominators differ, collapsible advanced controls, and a reset-to-defaults action.
- Redesigned standalone
proportion_stats()publication tables. Group values are now spanning headers with separate estimate and confidence-interval columns, while$summaryremains a tidy long-form result. The compact row added byadd_proportion()is unchanged. - Redesigned standalone
rate_stats()publication tables to use group spanners with separate Events, accumulated time, Rate and confidence-interval columns.$summaryremains tidy andadd_rate()remains unchanged. - Corrected independent 2 x 2 audit wording from "complete pairs" to "complete observations", and ensured
diagnostics_stats()identifies the crosstab outcome instead of displaying a missing variable name. - Automatic continuous comparisons now reserve rank-based methods for marked skewness. Shapiro-Wilk and mild asymmetry remain supporting information, so
compare_groups()andadd_p()consistently use Welch methods for the birth-weight example's maternal age. assess_variance()now displaystest = "levene"by default, implemented as the median-centred Brown-Forsythe modification. It is supporting information and never changes automatic test selection.- Restored variance to the visible
assess_variance()output: every group cell now shows n, SD, and variance, with both observed SD and variance ratios shown in the publication table. No additional argument is required. - Paired comparison output now labels the estimate as a mean within-pair difference and reports exclusions caused by incomplete or non-unique pairs. Paired publication tables now identify the complete-pair denominator; McNemar/Cochran's Q notes are binary-specific; and Friedman fails clearly when there is no within-participant variation instead of printing
NA. assess_variance()now explicitly states that its spread diagnostics do not assess pairing or repeated-measures sphericity. Its interpretation no longer implies that Welch methods resolve repeated-measures assumptions.add_proportion()now preserves an explicitly supplied publication label exactly and explains whyadd_p()does not duplicate the full-variable p-value on a selected-event row.compare_groups()now has a publicvar_equalargument. The default remainsFALSE, retaining Welch t-tests and Welch ANOVA for suitable independent continuous automatic comparisons. Setvar_equal = TRUEonly for a prespecified equal-variance assumption; it selects Student's t-test or classical ANOVA and is never inferred using a variance hypothesis test.add_p()andplot_compare(show_p = TRUE)now forwardvar_equalto the same comparison engine, so their selected methods remain consistent.summary_table(),add_summary(),add_proportion(), andadd_rate()now supportlayout = "separate", which places estimates and confidence intervals in child columns beneath each cohort header. The backward-compatible"compact"layout remains the default.- Standardised the public result-output contract. Core analytical functions now accept
format = "table"(the publication-ready default) orformat = "tibble"for plain console output. The earlieroutputargument remains a compatibility alias ondescribe_data(),assess_distribution(), andassess_variance(). The assumptions, diagnostics, and denominator inspection helpers now follow the same publication-table default andformat = "tibble"console route. - Corrected the paired manual case study to use
summary_table(by = visit)and added an explicit console example for variance diagnostics. - Redesigned the app's Summary table workspace as a five-stage ribbon (Foundation, Statistics, P-values, Add, and Design). Foundation keeps data, compact searchable variable selection, grouping and Overall together. Downloads and reusable R code now sit with the persistent publication preview instead of occupying a separate Export tab.
- Made Summary-table variable selection explicitly reversible: the app shows selected and available-variable counts, provides an Add variables button, and reopens the searchable list after an item is removed. Ribbon menus now render beyond their cards instead of being clipped.
- Added
epi_table()for publication-ready outbreak and surveillance tables from either individual line-list data or aggregate numerator/denominator data. The function makes events, denominators, scale and confidence-interval methods explicit; optional p-values and two-group epidemiological effects are separate reporting layers.
From NEWS.md in the release
Install
Health
- OK13 OKNow
- OK5 OK2026-09-22
Documentation
- Help pages
- 46
- Examples that run
- 95%42 run in a plain check (1 of them under a condition) · 2 only when donttest examples are enabled (R CMD check --as-cran)
- Exported functions with examples
- 100%
- Documented parameters
- 85%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
Stars over time
9 development-tooling and community-health practices detected across 5 families in the upstream repository
Checks run against github.com/thinkdenominator/gtstats on 2026-10-11.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-09-28 · The repository has a site deploy workflow
pkgdown site last built 2026-09-28
Show all practicesHide 1 practice
Dependencies
Installing gtstats adds 79 packages (43 with compiled code, 73 MB of source tarballs). Heaviest: stringi 11 MB, ggplot2 6.0 MB, data.table 5.7 MB.
CRAN will archive these unless their check problems are fixed by the date shown. This package needs each one to install.
- flextablefix by Oct 22
Code & Tests
Datasets
People & History
- 1.0.0Latest2026-09-21 · current release
- RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-09-21
- Total releases
- 1 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Bundled data
- 15 KB / 5 files
- Download size
- 547 KB
Cite
Cite this package
Run in R for the authors' entry:
citation("gtstats")The package provides a citation file, so citation() returns the authors' own entry.
The repository also keeps a CITATION.cff.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-18, which the citation names so these numbers can be found later. More on citing and the projects behind them.