Summarize value over the trailing epiweek

average_to_epiweek(daily_df, return_sum = TRUE)

sum_to_epiweek(daily_df)

Arguments

daily_df

a data frame containing the columns time_value, geo_value, and value. Additional columns are ignored

return_sum

multiply the average by 7 to compute the total cases per week (the default) or return the average over the week

Value

a data frame of the same type with 1 row per complete epiweek. The time_value entries will be modified to correspond to the last day (a Saturday) of each epiweek.

These functions vary only in the manner of the calculation. average_*() computes the average over the week ignoring NA's and returns the result. sum_* sums over the epiweek. Thus in the absence of missing values, the results (when return_sum = TRUE) will be the same. However, if there are missing values, the result of sum_*() will be lower but will accurately reflect the reported totals.