tests/testthat/test-ggsdc.R

test_that("ggsdc decompose produces a plot with four facets", {
   ap_df <- tsdf(AirPassengers)
   tmp <- ggsdc(ap_df, aes(x = x, y = y), method = "decompose") +
      geom_line() +
      labs(x = "Time", y = "Air Passengers")
   expect_equal(dim(tmp$data), c(576, 3))
   expect_equal(tmp$labels$y, "Air Passengers")
})
   
test_that("ggsdc stl produces a plot with four facets", {
   ap_df <- tsdf(AirPassengers)
   tmp <- ggsdc(ap_df, aes(x = x, y = y), method = "stl", s.window = 7) +
      geom_line() +
      labs(x = "Time", y = "Air Passengers")
   expect_equal(dim(tmp$data), c(576, 3))
   expect_equal(tmp$labels$y, "Air Passengers")
})

Try the ggseas package in your browser

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

ggseas documentation built on May 1, 2019, 9:47 p.m.