CLiREN-LMS
Data Analysis in R

Creating Report-Ready Tables in R

Creating Report-Ready Tables in R

30-45 minutes Applied Step 5 of 9
Accordion

Creating Report-Ready Tables in R

5 / 9
Accordion

Creating Report-Ready Tables in R

Part 1
R can produce summary tables that are suitable for review, reports, and manuscripts. For early learning, learners can build tables with `dplyr` and `janitor`. For more polished tables, packages such as `gtsummary` provide convenient tools for reproducible clinical-style summary tables [@sjoberg2021gtsummary]. A common table in clinical research is a baseline characteristics table. It may show age, sex, site, baseline severity, and other variables overall and by treatment arm. The following example uses `gtsummary`: This code creates a table grouped by treatment arm, includes missing values where present, summarizes continuous variables using median and interquartile range, and summarizes categorical variables using counts and percentages. The labels make the table easier to read. The table is generated from code, which means it can be rerun after the dataset is updated.
Part 2
The learner should understand the table, not merely generate it. The statistic argument defines how variables are summarized. The `by` argument defines the grouping variable. The missing argument determines how missing values are displayed. The labels define what readers see. Each of these choices affects interpretation. For data management reports, a simpler table may be better: This table is operational. It can be exported as CSV, included in an HTML report, or used as the basis for a dashboard. Unlike a manuscript table, it focuses on data quality and follow-up actions.
Part 3
Report-ready does not mean visually decorated. A good table has a clear title, meaningful variable labels, stated denominators, appropriate rounding, visible missing data, and footnotes where needed. Overly polished tables can still be misleading if the underlying logic is unclear. A report-ready table should be reviewed by someone who understands both the code and the clinical context. Reproducible output is not automatically correct output.