Description Usage Arguments Details Value Examples
This function was written to overcome the fact that the Covid Historical Data Table has negative counts on a few days in the time series because of changes in the underlying data. The function fixes that by subtracting the negative count from the prior positive day's count.
1 | clean_reversals(daily_time_series, verbose = TRUE)
|
daily_time_series |
a time series of count data in chronological order |
verbose |
a logical where FALSE means messages are suppressed. Default = TRUE |
If there are two or more negative counts in a row, the function subtracts the sum of the negative count from the most recent day with a positive count. It will issue a warning if this cleaning algorithm results in a daily time series that still has negative counts.
This algorithm ensures that the total cumulative count after the cleaning is equal to what it was originally.
a vector of counts of the same length as the original
1 2 3 4 5 6 7 8 9 10 | ## Not run:
suppressPackageStartupMessages(library(dplyr))
pull_histTable() %>%
group_by(fips) %>%
mutate(
tests_daily_clean = clean_reversals(tests_daily)
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.