data("kennel_2020")
kennel_2020[, datetime := as.numeric(datetime)]
kennel_2020[, wl2 := wl * 0.8]
formula <- as.formula(wl + wl2~.)
n_knots <- 12
deg_free <- 27
max_lag <- 1 + 720
formula <- as.formula(wl+wl2~.)
formula2 <- as.formula(wl+wl2~spline_b_datetime_25 )
formula3 <- as.formula(wl+wl2~spline_b_datetime_25 + spline_b_datetime_26)
hrec = hydrorecipes:::Recipe$new(formula = formula, data = unclass(kennel_2020))$
add_step(hydrorecipes:::StepDistributedLag$new(baro,
knots = hydrorecipes:::log_lags(n_knots, max_lag)))$
add_step(hydrorecipes:::StepDistributedLag$new(et,
knots = hydrorecipes:::log_lags(n_knots, max_lag)))$
add_step(hydrorecipes:::StepSplineB$new(datetime, df = deg_free, intercept = FALSE))$
add_step(hydrorecipes:::StepIntercept$new())$
add_step(hydrorecipes:::StepDropColumns$new(baro))$
add_step(hydrorecipes:::StepHarmonic$new(datetime, frequency = c(1, 2, 3), cycle_size = 86400))$
add_step(hydrorecipes:::StepEarthtide$new(datetime, do_predict = FALSE, astro_update = 30))$
# add_step(hydrorecipes:::StepDropColumns$new(et))$
add_step(hydrorecipes:::StepDropColumns$new(datetime))$
add_step(hydrorecipes:::StepOls$new(formula))$
add_step(hydrorecipes:::StepOls$new(formula2))$
add_step(hydrorecipes:::StepOls$new(formula3))$
prep()$
bake()
hrec$get_response_data(type = 'dt')[grep("harmonic", step_id)]
hrec$get_response_data(type = 'dt')[grep("earthtide", step_id)]
hrec$get_response_data(type = 'dt')[grep("spline", step_id)]
hrec = hydrorecipes:::Recipe$new(formula = formula, data = unclass(kennel_2020))$
add_step(hydrorecipes:::StepDistributedLag$new(baro,
knots = hydrorecipes:::log_lags(n_knots, max_lag)))$
add_step(hydrorecipes:::StepDistributedLag$new(et,
knots = hydrorecipes:::log_lags(n_knots, max_lag)))$
add_step(hydrorecipes:::StepSplineB$new(datetime, df = deg_free, intercept = FALSE))$
add_step(hydrorecipes:::StepIntercept$new())$
add_step(hydrorecipes:::StepDropColumns$new(baro))$
add_step(hydrorecipes:::StepHarmonic$new(datetime, frequency = c(1, 2, 3), cycle_size = 86400))$
add_step(hydrorecipes:::StepEarthtide$new(datetime, do_predict = FALSE, astro_update = 30))$
# add_step(hydrorecipes:::StepDropColumns$new(et))$
add_step(hydrorecipes:::StepDropColumns$new(datetime))$
add_step(hydrorecipes:::StepOls$new(formula))$
prep()$
bake()
expect_equivalent(class(hrec$get_response_data(type = 'dt')),
c("data.table", "data.frame"))
expect_equivalent(nrow(hrec$get_response_data(type = 'dt')),
5850L)
expect_equivalent(class(hrec$get_response_data(type = 'df')),
"data.frame")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.