Description Usage Arguments Details Value
View source: R/setup_simulation.R
This function creates a state_df
dataframe object, which is used to track
active cases in the simulation.
1 2 3 4 5 6 7 8 9 | create_state_df(
n_cases,
sim_params,
sim_status,
initialize = FALSE,
import = FALSE,
primary_state_df = NULL,
primary_case_ids = NULL
)
|
n_cases |
The number of cases to initialize in this dataframe |
sim_params |
The |
sim_status |
The |
initialize |
A boolean indicating whether these cases are the first cases of the
simulation. Defaults to |
import |
A boolean indicating whether these new cases are imported cases instead
of secondary infections. Defaults to |
primary_state_df |
When generating a |
primary_case_ids |
When generating a |
The simulation's main state_df
dataframe is created with this
function at the beginning of the simulation. When new cases are added (secondary or
imported infections), a state_df
dataframe is created for these new cases
by generate_secondary_infections
and generate_imported_infections
.
The new state_df
object is merged with the main state_df
within
step_simulation
.
The columns of this dataframe are: case_id
, status
, is_traced
,
is_trace_app_user
, is_trace_app_comply
, is_traced_by_app
,
is_symptomatic
, days_infected
, incubation_length
,
isolation_delay
, infection_length
, contact_rate
,
n_sec_infects
, and generation_intervals
. The meaning of these columns
will be documented elsewhere. Most of the columns are constant and are initialized
in this function via calls to related functions in draw_distributions.R. All time lengths
are in days and represent a relative time, not absolute times. The
status
, n_sec_infects
and generation_intervals
columns are updated
over the course of the simulation as cases progress through infection states. The
n_sec_infects
counter and corresponding generation_intervals
list have its
elements removed as the secondary infections are loaded into the simulation. As cases
become isolated or inactive and no longer cause infections, they are removed from this
dataframe.
A companion dataframe, rec_df
, is meant to be a complete record of all cases
that occurred in the simulation. This object is created by create_record_df
and tracks all times as the absolute amount of time passed since the simulation start.
A state_df
dataframe object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.