I'm receivng the following error message despite double checking that the control_str variable is accounted for and all variables are chr or num:
Error in mutate()
:
In argument:
df_stats = pmap(...)
.
Caused by error in pmap()
:
In index: 3.
Caused by error in abort()
:
! message
must be a character vector, not a <rlang_error/error/condition> object.
Backtrace:
- ... %>% bold_labels()
- gtsummary:::safe_summarise_at(., variable = variable, fns = fns)
- base::tryCatch(...)
- base (local) tryCatchList(expr, classes, parentenv, handlers)
- base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
- value[3L]
- rlang::abort(message = e)
tbl1_completecases <- ComPAS_MUAC115_LinearGrowth_ForAnalysis_completecases_tbl1 %>%
tbl_summary(
by = control_str,
type = all_continuous() ~ "continuous2",
statistic = all_continuous() ~ c("{mean} +/- {sd}",
"{median} ({p25}, {p75})",
"{min}, {max}"),
missing = "no"
) %>%
add_n() %>% # add column with the total number of non-missing observations
add_p() %>% # test for a difference between groups
modify_header(label = "**Variable**") %>% # update the column header
add_overall() %>%
modify_footnote(
update = all_stat_cols() ~ "Unadjusted - complete cases"
) %>%
modify_caption("**Table 1: By control group - Complete Cases**") %>%
bold_labels()