| format_data | R Documentation |
The purpose of this function is to format any data input
to be used directly in the pandemic_model function as the
Y argument.
format_data( s_date, e_date, cases = NULL, n_cases = NULL, deaths = NULL, n_deaths = NULL, name, pop )
s_date |
start date of the time series. It should be in the YYYY-MM-DD format. |
e_date |
end date of the time series. It should be in the YYYY-MM-DD format. |
cases |
numeric vector containing the cumulative case counts per day from the start date until the end date. |
n_cases |
numeric vector containing the new case counts per day from the start date until the end date. |
deaths |
numeric vector containing the cumulative death counts per day from the start date until the end date. |
n_deaths |
numeric vector containing the new death counts per day from the start date until the end date. |
name |
string specifying the location name. |
pop |
numeric object that contains the population size of the given location. |
This function requires that at least one of the data inputs cases,
n_cases, deaths, n_deaths is provided. If only cumulative data was inserted,
format_data will automatically calculate the new case counts. On the contrary,
if only new case counts were provided, then the cumulative counts will be calculated.
Check covid19BH for a complete example on how to use this function.
An object of S3 class pandemicData. It is a list with 3 items:
data: data frame with the number of cumulative cases, new cases
or/and cumulative deaths and new deaths for each date, from s_date up to the e_date in the specified region.
name:string with the location name.
population:numeric object that contains the population size of the given location.
covid19BH
## Not run:
#illustrative epidemiological data
cases <- c(0,1,4,7,10,19)
n_cases <- c(cases[1], diff(cases))
#format data to use in pandemic_model
data <- format_data(s_date = "2021-01-01", e_date = "2021-01-06",
cases = cases, n_cases = n_cases,
name = "Example", pop = 1234)
data
plot(data)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.