tests/testthat/test-format_survival.R

test_that("survival output", {
  skip_if_not_installed("survival", "3.2.9")

  x <- head(survival::Surv(survival::lung$time, survival::lung$status))
  expect_snapshot({
    pillar(x, width = 20)
    new_tbl(list(x = x))
  })

  skip_if_not(exists("Surv2", asNamespace("survival"), mode = "function"))

  x <- head(survival::Surv2(survival::lung$time, survival::lung$status))
  expect_snapshot({
    pillar(x, width = 20)
    new_tbl(list(x = x))
  })
})

Try the pillar package in your browser

Any scripts or data that you put into this service are public.

pillar documentation built on March 31, 2023, 10:19 p.m.