| envToTibble | R Documentation |
Convert babsim simulation results to tibble data.
Input: simmer simulation environment and field data formatted
using getRealBeds. The formatted filed date has dim (nxm, 5), the output data
has dimension (nxm, 15).
The method get_mon_resources function is used to extract information from
the babsim.hospital simulation.
The function is used by modelResultHospital to prepare the calculation of the error.
envToTibble(envs, fieldEvents, conf, dontFilter = FALSE)
envs |
|
fieldEvents |
Real values. Output from
|
conf |
list with the following entries (generated with
|
dontFilter |
do not filter by date (used in subsimulations) |
get_mon_resources returns state changes in resources:
'resource': resources name
'time': time instant of the event that triggered the state change
'server': server count
'queue': queue count
'capacity': capacity
'queue_size': queue size
'system': system count (server + queue). If no queues are used, system values equal server values.
'system_limit': system limit (capacity + queue_size)
This function returns an env data frame (tibble [nxm, 15] (S3: grouped_df/tbl_df/tbl/data.frame)) with the following entries:
resource (chr)name of the seized resource: 'bed' 'bed' 'bed' 'bed' ...
time (num)time step: 3 10 12 13 14 15 15 15 15 16 ...
server (int)server: 1 2 3 2 3 4 3 4 5 6 ...
limit (num)limit: Inf Inf Inf Inf Inf ...
replication (int)replication: 1 1 1 1 1 1 1 1 1 1 ...
upper (int)upper: 1 2 3 2 3 5 5 5 5 7 ...
lower (int)lower: 1 2 3 2 3 3 3 3 3 5 ...
med (num)med: 1 2 3 2 3 4 4 4 4 6 ...
date (POSIXct)time, format: yyyy-mm-dd hh:mm.ss
rwdate (POSIXct)format: '2020-03-01' '2020-03-08' '2020-03-15' '2020-03-15' ...
source (chr)name of the simulation that was used: 'babsim' 'babsim' 'babsim' 'babsim' ...
modelResultHospital
data <- getSyntheticData()
para <- babsimHospitalPara()
conf <- babsimToolsConf()
conf <- getConfFromData(
conf = conf,
simData = data$simData,
fieldData = data$fieldData
)
arrivalTimes <- getArrivalTimes(data$simData$Infected)
fieldEvents <- getRealBeds(
data = data$fieldData,
resource = c("bed", "intensiveBed", "intensiveBedVentilation")
)
envs <- babsimHospital(arrivalTimes = arrivalTimes, conf = conf, para = para)
res <- envToTibble(envs = envs, conf = conf, fieldEvents = fieldEvents)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.