tests/testthat/test-modify_missing_symbol.R

skip_on_cran()
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 June 11, 2025, 10:29 p.m.