To test whether there is an association between disease groups (categorical_variable) and a disease (outcome; dichotomous) I am running a logistic regression. To check for confounding by other variables I am running 3 models with various amounts of covariates.
To display the ORs and CIs i am using the tbl_regression function from the package gtsummary (and I used the dplyr function mutate to display CIs in round brackets). However, this displays the CI in a seperate column from the OR, but I want them in the same column with the CI in round brackets after the OR.
My code:
library(gtsummary)
library(dplyr)
Model 1 <-
glm(data=wide_dataset, formula=outcome ~ categorical_variable,
family=binomial(link="logit") %>%
tbl_regression(
exponentiate = TRUE) %>%
# remove the p-value column
modify_column_hide(column=p.value) %>%
# CI in round brackets:
modify_table_body(mutate,
ci=gsub("(\\d\\.\\d{,4})(, )(\\d\\.\\d{,4})"
,"\\(\\1 \\3\\)",
ci))
Model 1
Thanks in advance!

