Need a Table 1?
When making tables for publication, one of the most common ones we need are Table 1’s: the summarization of our study populations in terms of demographics.
Oftentimes, this would require tedious formatting in something like Word or Excel, especially when we want to include confidence intervals in the same cell, and of course, we need to calculate p-values between groups.
Well, Daniel Sjoberg’s {gtsummary}
package is here to save you a lot of work!
Learning Objectives
- Explain the major use case of
{gtsummary}
- Utilize
{gtsummary}
features to summarize your cohort - Output
{gtsummary}
tables in a variety of formats
Our Cohort: Penguins
We’re going to use the palmerpenguins
dataset as our example cohort. As a reminder, here’s the first few rows of this dataset.
Summary Table of Penguins
{gtsummary}
lets you build up a summary demographics table with dplyr
commands and special summarization commands.
Here, we pass our columns into the tbl_summary()
function, which is the start of interacting with {gtsummary}
:
Comparing Groups
Here we want to look at the intersection of species by island, as well as the distribution of bill lengths:
We can also add N’s and P-values:
Here you can see we did a chi-squared test to look at combinations of island
and species
, and we did a Kruskal-Wallis rank sum to compare bill_length_mm
across species
.
This is just the tip of the iceberg for {gtsummary}
. You also can output to Microsoft Word for further tweaks.
Citation
@online{laderas2024,
author = {Laderas, Ted},
title = {Make Your {Table} 1 with \{Gtsummary\}},
date = {2024-09-04},
langid = {en}
}