简体   繁体   中英

How can to combine odds ratios and the confidence intervals

I am trying to combine the ORs and confidence interval in one column so as to achieve the following results 1.10(0.52,2.29)

library(gtsummary)

trial %>% 
  select(response, grade) %>% 
  tbl_uvregression(
    method = glm,
    y = response,
    method.args = list(family = binomial),
    exponentiate = TRUE
  )

You can use the modify_table_styling() function to merge two or more columns. Example below!

library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.4.0'

tbl <-
  trial %>% 
  select(response, grade) %>% 
  tbl_uvregression(
    method = glm,
    y = response,
    method.args = list(family = binomial),
    exponentiate = TRUE
  ) %>%
  modify_table_styling(
    columns = estimate,
    rows = !is.na(ci),
    cols_merge_pattern = "{estimate} ({ci})"
  ) %>%
  modify_header(estimate ~ "**OR (95% CI)**") %>%
  modify_footnote(estimate ~ "OR = Odds Ratio, CI = Confidence Interval",
                  abbreviation = TRUE)

在此处输入图像描述 Created on 2021-05-03 by the reprex package (v2.0.0)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM