I am using gtsummary package to tabulate my regression results.
With difficulty, I have tried to give my table a spanning header using the following function modify_spanning_header(starts_with("stat_") ~ "**Logistic regression for years in US states**")
.
When I use this function along with the code below, I get the following response:
Error: Can't join on `x$column` x `y$column` because of incompatible types.
ℹ `x$column` is of type <character>>.
ℹ `y$column` is of type <integer>>.
Any idea what this could be? The full code which includes dummy data and packages is as follows:
# load packages
library(gtsummary)
# dummy data
crime <-data.frame(State = sample(c("SF", "AR", "NYC","MN"),13000,replace = TRUE),
Year = sample(as.factor(c(1990, 2000)),13000, replace = TRUE)
)
# logistic model with visual
glm(Year ~ State, data = crime, family = binomial) %>%
tbl_regression(exponentiate = TRUE)
I am trying to follow and reproduce example two in this vignette - see here.