tests/testthat/test-plot-duration-units.R

test_that("workflow plotting functions label standardized durations in minutes", {
  raw <- simulate_tls(family = "binomial", CTmax = 36, z = 4,
                      tref = 1, seed = 91)
  dat <- standardize_data(
    raw, temp = "temp", duration = "duration", n_total = "total",
    n_surv = "survived", duration_unit = "hours"
  )
  fit <- suppressMessages(fit_4pl(dat, family = "binomial", t_ref = 60,
                                  method = "wald", quiet = TRUE))

  survival <- plot_survival_curves(fit)
  tdt <- plot_tdt_curve(fit)
  surface <- plot_survival_surface(fit)

  expect_match(survival$labels$x, "minutes")
  expect_match(survival$labels$caption, "tref = 60 minutes")
  expect_match(tdt$labels$y, "minutes")
  expect_match(tdt$labels$caption, "tref = 60 minutes")
  expect_match(surface$labels$y, "minutes")
  expect_match(surface$labels$caption, "tref = 60 minutes")
})

Try the freqTLS package in your browser

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

freqTLS documentation built on Dec. 4, 2026, 5:11 p.m.