tests/testthat/test-movmean.R

context("test-movmean")

test_that("movmean works", {
    x <- 1:100
    x[50] <- NA
    x[80] <- Inf
    halfwin <- 10
    s1 <- movmean(x, 2, SG_style = FALSE)

    expect_true(all(is.finite(s1)))

    x <- c(rep(Inf, 4), 1, 2, 3, NA)
    expect_silent(s2 <- movmean(x, 2, SG_style = TRUE))
    expect_equal(movmean(x, 2, SG_style = FALSE)[1:3], c(NA, NA, 1))
})

Try the phenofit package in your browser

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

phenofit documentation built on Feb. 16, 2023, 6:21 p.m.