tests/testthat/test-subsetting.R

## Test subsetting methods `[`

test_that("subsetting works for smooth_samples", {
  sm <- smooth_samples(m_gam, seed = 42)
  hsm <- head(sm)
  expect_identical(NROW(hsm), 6L)
  expect_true(!is.null(attr(hsm, "seed")))

  attrs <- attributes(hsm)
  expect_type(attrs, "list")
  expect_named(attrs,
    expected = c("names", "row.names", "class", "seed", "data_names")
  )
})

Try the gratia package in your browser

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

gratia documentation built on June 25, 2024, 5:08 p.m.