tests/testthat/test_thin.R

test_that("thinning reduces number of events",{
  x = p3(1, 0, 1, n = 100)
  th = thin(x, function(x) 0.5)
  expect_true(length(th) < length(x))
})

test_that("thinning with 1 keeps data identical",{
  x = p3(1, 0, 1, n = 100)
  expect_equal(thin(x, function(x) 1), x)
})

Try the StratPal package in your browser

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

StratPal documentation built on Dec. 6, 2025, 5:08 p.m.