Thanks to @DanielD.Sjoberg for pointing me towards the documentation to solve this, link here.
Corrected code is below so folks can reference this going forward.
## Use gtsummary package to create descriptive statistics table
descriptivestable <- KUWRowPowerDF |>
select(all_of(allvars)) |>
tbl_summary(
type = all_of(c(normalvar, nonnormalvar)) ~ "continuous",
statistic = list(
all_of(normalvar) ~ "{mean} (\u00B1 {sd})",
all_of(nonnormalvar) ~ "{median} ({p25}, {p75})"
),
digits = all_continuous() ~ 1,
label = list(
`Age` ~ "Age (years)",
`Height_cm` ~ "Height (cm)",
`Weight_kg` ~ "Weight (kg)",
`On-Water_Rowing_Experience` ~ "On-Water Rowing Experience (Years)",
`Indoor_Rowing_Experience` ~ "Indoor Rowing Experience (Years)",
`7-Stroke_W` ~ "7-Stroke Peak Power Test (W)",
`7-Stroke_W/kg` ~ "7-Stroke Peak Power Test (W/kg)",
`20-Second_W` ~ "20-Second All Out Test (W)",
`20-Second_W/kg` ~ "20-Second All Out Test (W/kg)",
`60-Second_W` ~ "60-Second All Out Test (W)",
`60-Second_W/kg` ~ "60-Second All Out Test (W/kg)",
`2k_Avg_W` ~ "2,000-meter (W)",
`2k_W/kg` ~ "2,000-meter (W/kg)",
`2k_Avg_Speed_m/s` ~ "2,000-meter Speed (m/s)",
`2k_Stroke_length` ~ "2,000-meter Stroke Length (m)",
`2k_Total_Time_sec` ~ "2,000-meter Time (s)"
)
) |>
add_stat(fns = stat_fns) |>
modify_header(
stat_0 ~ "**Mean ± SD**",
add_stat_1 ~ "**Shapiro–Wilk p**",
label ~ "**Variable**"
) |>
bold_labels() |>
remove_footnote_header(columns = all_stat_cols()) |>
modify_footnote_body(
footnote = "Denotes non-normally distributed variable, reported as Median + IQR (p25, p75)",
columns = label,
rows = variable %in% c("Age",
"On-Water_Rowing_Experience",
"Indoor_Rowing_Experience",
"20-Second_W",
"2k_Avg_Speed_m/s")
& row_type == "label"
) |>
modify_table_body(~ .x |>
arrange(factor(variable, levels = allvars))
) |>
as_gt() |>
gt::tab_header(title = md("**Table 1 | Participant Characteristics**"),
subtitle = md("**N = 40; p ≤ 0.05**")
)
descriptivestable