tests/testthat/test-stats-time-series.R

context("stats-time-series")

skip_if_not_installed("modeltests")
library(modeltests)

test_that("tidy.acf works", {
  check_arguments(tidy.acf)

  result <- acf(lh, plot = FALSE)
  td <- tidy(result)
  check_tidy_output(td)
  check_dims(td, 17, 2)
})


test_that("tidy.ts", {
  check_arguments(tidy.ts)

  x <- ts(1:10, frequency = 4, start = c(1959, 2))
  td <- tidy(x)
  check_tidy_output(td)

  z <- ts(matrix(rnorm(300), 100, 3), start = c(1961, 1), frequency = 12)
  td2 <- tidy(z)
  check_tidy_output(td2)
})


test_that("tidy.spec", {
  check_arguments(tidy.spec)

  spc <- spectrum(lh, plot = FALSE)
  td <- tidy(spc)

  check_tidy_output(td, strict = FALSE)
  check_dims(td, 24, 2)
})

Try the broom package in your browser

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

broom documentation built on Sept. 30, 2024, 9:29 a.m.