getRealBeds: getRealBeds

View source: R/getRealBeds.R

getRealBedsR 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)



(n, m) data frame with daily bed data, e.g., from icudata


vector of resource names, e.g., 'bed'. Default: resource=c('bed', 'intensiveBedVentilation'). For GA data use: resource=c('bed', 'intensiveBed', 'intensiveBedVentilation')


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

See Also



# First example shows how to process the GA data
GABeds <- getRealBeds(
  data =,
  resource = c("bed", "intensiveBed", "intensiveBedVentilation")

# Second example shows how to process the DIVI ICU data.
icu <-
icuCov <- ~ daten_stand, icu))
icuCov$daten_stand <- as.Date(icuCov$daten_stand)
icuCovBeatm <- ~ 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")
) documentation built on May 30, 2022, 9:05 a.m.