使用gtsummary包,当我尝试将回归表设置为日记格式(在这种情况下为JAMA)时,出现以下错误:
Error in theme_gtsummary_journal(., journal = "jama") :
'list' object cannot be coerced to type 'logical'
有人知道这是为什么吗?数据和库的代码如下:
# 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)
)
# multinom model with visual
glm(Year ~ State, data = crime, family = binomial) %>%
tbl_regression(exponentiate = TRUE) %>%
theme_gtsummary_journal(journal = "jama")
答案 0 :(得分:4)
问题在于,在gtsummary
中您没有像在ggplot2中那样添加主题。相反,您必须设置主题。参见gtsummary themes vignette:
# load packages
library(gtsummary)
set.seed(42)
# 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)
)
tab <- glm(Year ~ State, data = crime, family = binomial) %>%
tbl_regression(exponentiate = TRUE)
# Set theme
theme_gtsummary_journal(journal = "lancet")
tab
# Reset theme
reset_gtsummary_theme()