tests/testthat/test-modify_missing_symbol.R

skip_if_not(is_pkg_installed(c("cardx", "broom.helpers")))

test_that("modify_missing_symbol()", {
  expect_equal(
    lm(marker ~ trt, data = trial) |>
      tbl_regression() |>
      modify_missing_symbol(
        symbol = "Ref.",
        columns = c(estimate, conf.low, conf.high),
        rows = reference_row == TRUE
      ) |>
      as.data.frame(fmt_missing = TRUE, col_labels = FALSE) %>%
      `[`(2, c("estimate", "conf.low")) |>
      unlist() |>
      unique(),
    "Ref."
  )
})
ddsjoberg/gtsummary documentation built on March 1, 2025, 7:52 p.m.