tests/testthat/test-lifetable.R

test_that("ausfertility", {
  expect_error(aus_fertility |> life_table())
})

test_that("ausmortality", {
  lt <- aus_mortality |>
    dplyr::filter(Year == 1950, Sex == "male", Code == "WA") |>
    life_table()
  expect_true(abs(lt$ex[10] - 60.05) < 1e-3)
})

Try the vital package in your browser

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

vital documentation built on June 22, 2024, 9:56 a.m.