convert_weekly: Convert long csse data from daily to weekly format

convert_weeklyR Documentation

Convert long csse data from daily to weekly format

Description

This function will take a long format csse file (for example something like that returned from get_us_from_cdp(cdp), or the long format returned from cssedata(), or the geo-level elements in the list returney us_empirical_by_level()) and convert it from daily data to weekly format. The function will use epiweek and epiyear from the lubridate package, and will define the end of the week as day of week 7. The general approach of the function is to sum up incident outcomes by epiweek/epiyear combinations, and then generate weekly cumulative data by using baseR cumsum function.

Usage

convert_weekly(df, byvars = NULL)

Arguments

df

this is the source long formatted data described above

byvars

defaults to NULL, character vector of columns names to group by

Examples

convert_weekly(us)
convert_weekly(get_state_from_cdp("Texas",cdp), byvar="USPS")
convert_weekly(county, byvars="FIPS")

lmullany/rawcoviddata documentation built on March 21, 2023, 10:04 a.m.