tests/testthat/test-interpolate.R

context("test-interpolate.R")

test_that("Test interpolation", {
  skip_if_not_installed("fable")
  NA_pos <- c(0, sample(seq_len(NROW(us_deaths)), 10), NROW(us_deaths))
  us_deaths$value[NA_pos] <- NA
  mbl_miss <- us_deaths %>%
    model(fable::TSLM(value ~ trend() + season()))
  interpolated <- interpolate(mbl_miss, us_deaths)
  expect_true(all(!is.na(interpolated$value)))
})

Try the fabletools package in your browser

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

fabletools documentation built on Oct. 12, 2023, 1:07 a.m.