tests/testthat/test-zoo_aggregate.R

test_that("`zoo_aggregate()` works", {

  x <- zoo_simulate(rows = 1000, time_range = c("0000-01-01", as.character(Sys.Date())), seed = 1)

  x_millennia <- zoo_aggregate(x = x, new_time = "millennia", f = mean)

  expect_equal(nrow(x_millennia), 4)

  x_centuries <- zoo_aggregate(x = x, new_time = "centuries", f = max)

  expect_equal(nrow(x_centuries), 22)

})

Try the distantia package in your browser

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

distantia documentation built on April 4, 2025, 5:42 a.m.