This function obtains the COVID-19 observation data based on the chosen source.
Usage
get_covid19_obs(
source = c("covidcast", "cache", "test"),
start_date,
end_date,
write_copy = TRUE
)
Arguments
- source
A character string indicating the source of the data to be obtained. Allowed values are "covidcast" (to fetch data using covidcast), "cache" (to read data from local cache) and "test" (to load test data).
- start_date
A character string indicating the start date of the period for which the data is needed. The date should be in the format "YYYY-MM-DD".
- end_date
A character string indicating the end date of the period for which the data is needed. The date should be in the format "YYYY-MM-DD".
- write_copy
A logical value indicating whether the data obtained should be written to a file or not. The default value is TRUE.
Details
If source = "covidcast", the function fetches the COVID-19 observation data using the covidcast package. If source = "cache", the function reads the COVID-19 observation data from the local cache. If source = "test", the function loads test data for the period 2021-06-28 through 2021-09-20. The function also loads state crosswalk data and performs some date checks and data filtering based on the selected source.
If write_copy = TRUE, the data obtained is written to a .csv file in a newly created directory named "observations" within the analysis directory.