I have a dependent variable with four outcomes. I have used the mlogit package to conduct a multinomial logistic regression.
When I try to present the results using gtsummary package, my multinomial logistic regression results are stacked on top of each other (see code and table below).
Is there anyway of having the outcomes side by side in one row using only one set of labels for the levels, instead of stacked on top of each other like the table below?
# load packages
library(gtsummary)
library(nnet)
# dummy data
crime <-data.frame(city = sample(c("SF", "AR", "NYC","MN"),13000,replace = TRUE),
year = sample(as.factor(c(1990, 2000, 1999, 1989)),13000,replace = TRUE)
)
# multinom model tabulated with gtsummary
multinom(city ~ year, data = crime) %>%
tbl_regression(exponentiate = T)
By default, multinomial models will be printed in long format.
I've written a small function to convert the results to wide and saved it as a GitHub Gist. https://gist.github.com/ddsjoberg/a55afa74ac58e1f895862fcabab62406