library(tidyverse, quietly = T, warn.conflicts = F)
context("fludiff")
test_that("fludiff output is canon", {
d <- flumodelr::fludta
d_pred <- fluserf(data=d, outc = perc_fludeaths, time = yrweek_dt)
d_diff <- fludiff(d_pred, obsvar = perc_fludeaths, fitvar = y0_ul)
#load data
dnames <- c("year", "week", "fludeaths", "alldeaths",
"perc_fludeaths", "yrweek_dt", "fluyr",
"prop_flupos", "week_in_order",
"epi", "y0", "y0_ul", "y_diff")
#Tests
expect_s3_class(d_diff, "data.frame")
expect_that(dnames, equals(names(d_diff)))
expect_type(d_diff$y_diff, "double")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.