# NOT RUN {
tbl <-
lm(time ~ ph.ecog + sex, survival::lung) %>%
tbl_regression(label = list(ph.ecog = "ECOG Score", sex = "Sex"))
# Example 1 ----------------------------------
add_significance_stars_ex1 <-
tbl %>%
add_significance_stars(hide_ci = FALSE, hide_p = FALSE)
# Example 2 ----------------------------------
add_significance_stars_ex2 <-
tbl %>%
add_significance_stars(
pattern = "{estimate} ({conf.low}, {conf.high}){stars}",
hide_ci = TRUE, hide_se = TRUE
) %>%
modify_header(estimate ~ "**Beta (95% CI)**") %>%
modify_footnote(estimate ~ "CI = Confidence Interval", abbreviation = TRUE)
# Example 3 ----------------------------------
# Use <br> to put a line break between beta and SE in HTML output
add_significance_stars_ex3 <-
tbl %>%
add_significance_stars(
hide_se = TRUE,
pattern = "{estimate}{stars}<br>({std.error})"
) %>%
modify_header(estimate ~ "**Beta (SE)**") %>%
modify_footnote(estimate ~ "SE = Standard Error", abbreviation = TRUE) %>%
as_gt() %>%
gt::tab_style(
style = "vertical-align:top",
locations = gt::cells_body(columns = label)
)
# }
Run the code above in your browser using DataLab