Skip to content

Commit

Permalink
clean up filtering of leading zeros
Browse files Browse the repository at this point in the history
  • Loading branch information
seabbs committed Dec 18, 2023
1 parent bc1c4c6 commit 8572fd8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions R/create.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ create_clean_reported_cases <- function(reported_cases, horizon,
reported_cases <- data.table::setorder(reported_cases, date)
## Filter out 0 reported cases from the beginning of the data
if (filter_leading_zeros) {
reported_cases <- reported_cases[order(date)][
,
cum_cases := cumsum(confirm, na.rm = TRUE)
][min(date[cum_cases > 0])][, cum_cases := NULL]
reported_cases <- reported_cases[order(date)][min(date[confirm > 0])]
}

# Check case counts preceding zero case counts and set to 7 day average if
Expand Down

0 comments on commit 8572fd8

Please sign in to comment.