getRealBeds | R Documentation |
Convert daily data, e.g., a data.frame with the columns
bed, intensiveBedVentilation, Day
into event data, e.g., a data.frame with the following columns
resource, time, med, source, date
.
getRealBeds(data, resource)
data |
(n, m) data frame with daily bed data, e.g.,
from |
resource |
vector of resource names, e.g., 'bed'. Default:
|
Prepares data for combination with output (env)
from simmer.
Extracts and formats real data from the real data sets, e.g.,
icudata
.
The resulting data frame can be combined with
the output from the simulation run.
Can be used to add the true data (ground truth) to the simulated data.
This function returns a (n x m, 5) data frame with:
resource
(chr)name of the seized resource
time
(int)time step, starts with 1
med
(int)amount of the seized resource
source
(chr)name of the simulation that was used
date
(Date)time, format: yyyy-mm-dd
getIcuBeds
.
# First example shows how to process the GA data GABeds <- getRealBeds( data = babsim.hospital::dataCovidBeds20200624, resource = c("bed", "intensiveBed", "intensiveBedVentilation") ) # Second example shows how to process the DIVI ICU data. icu <- babsim.hospital::icudata icuCov <- as.data.frame(xtabs(faelle_covid_aktuell ~ daten_stand, icu)) icuCov$daten_stand <- as.Date(icuCov$daten_stand) icuCovBeatm <- as.data.frame(xtabs(faelle_covid_aktuell_beatmet ~ daten_stand, icu)) icuCovBeatm$daten_stand <- as.Date(icuCovBeatm$daten_stand) Day <- as.Date(icuCovBeatm$daten_stand) dataICUBeds20200821 <- data.frame( bed = (icuCov$Freq - icuCovBeatm$Freq), intensiveBedVentilation = icuCovBeatm$Freq, Day = as.Date(icuCovBeatm$daten_stand) ) ICUBeds <- getRealBeds( data = dataICUBeds20200821, resource = c("bed", "intensiveBedVentilation") )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.