This function takes in a hospitalization data source and a forecast date and generates a dataframe with state-level hospitalizations from all time points as of that forecast date. If the vintaged data available as of a forecast date already exists, it pulls from that, otherwise it pulls from hosp data source and saves the file.
Usage
get_state_level_hosp_data(
hosp_data_source,
forecast_date,
hosp_data_dir,
population_data_path,
pull_from_local = FALSE
)
Arguments
- hosp_data_source
covidcast or another source (e.g. if pulling directly from DCIPHER or the S drive, will need to write relevant paths for this)
- forecast_date
date we want the data as of (as if we were making a forecast on that day)
- hosp_data_dir
if pulling from local, which directory to search for datestamped hospitalization data
- population_data_path
path to a table of state populations
- pull_from_local
if TRUE, look for local files first, default value is FALSE