tests/testthat/test-plot_anomalies.R

context("test-plot_anomalies.R")

test_that("errors on incorrect input", {
  expect_error(plot_anomalies(3))
})

test_that("returns a ggplot", {
    g <- tidyverse_cran_downloads %>%
        time_decompose(count, method = "stl") %>%
        anomalize(remainder, method = "iqr") %>%
        time_recompose() %>%
        plot_anomalies(time_recomposed = TRUE, ncol = 3)
    expect_s3_class(g, "ggplot")
})

Try the anomalize package in your browser

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

anomalize documentation built on Nov. 2, 2023, 5:13 p.m.