You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice for the user to have control over how sliding should operate when not all of the data is available (and for the documentation to describe what happens in this case). E.g., for the first 6 days present in an epi_tibble, should a 7-day rolling average return NA or return an average of the days that are available? It appears to currently do the latter. For example, see the first example in the slide vignette:
x %>%
group_by(geo_value) %>%
epi_slide(slide_fun = ~ Mean(.x$cases), n = 7) %>%
head(10)
## # A tibble: 10 × 4
## geo_value time_value cases slide_value
## <chr> <date> <dbl> <dbl>
## 1 ca 2020-06-01 2360 2360
## 2 ca 2020-06-02 2372 2366
## 3 ca 2020-06-03 2214 2315.
## 4 ca 2020-06-04 3011 2489.
## 5 ca 2020-06-05 3025 2596.
## 6 ca 2020-06-06 3046 2671.
## 7 ca 2020-06-07 2404 2633.
## 8 ca 2020-06-08 2385 2637.
## 9 ca 2020-06-09 2700 2684.
## 10 ca 2020-06-10 3208 2826.
The text was updated successfully, but these errors were encountered:
Thanks @jacobbien, good point. This would just be a matter of setting complete = TRUE (versus complete = FALSE, the default) in the call to the underlying slide function from slider, see documentation here.
And this could just be passed through the additional arguments ... in epi_slide(). See here for confirmation that those additional arguments get passed right to the underlying slide function.
So this is all functional already, but we should document it, and also probably demo it in the vignette.
Also, should we make the treatment here uniform across other slide utilities in the epitools package? For example, pct_change() is to report NA when the window isn't big enough (this is implemented on the side of the function that gets slid, itself, rather than through complete = TRUE; see here).
It would be nice for the user to have control over how sliding should operate when not all of the data is available (and for the documentation to describe what happens in this case). E.g., for the first 6 days present in an
epi_tibble
, should a 7-day rolling average returnNA
or return an average of the days that are available? It appears to currently do the latter. For example, see the first example in the slide vignette:The text was updated successfully, but these errors were encountered: