Reputation: 39
I'm trying to merge three regression tables (tbl_regression) using the tbl_merge function in the gtsummary package. I keep getting the error message: "All objects in 'tbls' must be class 'gtsummary'", but I cannot seem to find out how to solve the problem.
Can anyone help? Thank you!
Upvotes: 1
Views: 973
Reputation: 21
In case anyone comes across this issue in the future: I've seen this before when merging tbl_summary()
output. Example tables below.
t_1 <-
mtcars %>%
filter(am == 1) %>%
tbl_summary()
t_2 <-
mtcars %>%
filter(am == 0) %>%
tbl_summary()
In my case, I had typed the following when I encountered the error:
tbl_merge(
tbls = c(t_1, t_2),
tab_spanner = c("**am == 1**", "**am == 0**")
)
however, as shown in the tbl_merge
documentation, the tbls=
argument must be a list as below.
tbl_merge(
tbls = list(t_1, t_2),
tab_spanner = c("**am == 1**", "**am == 0**")
)
Upvotes: 2