getRealBeds {babsim.hospital}R Documentation

getRealBeds

Description

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.

Usage

getRealBeds(data, resource)

Arguments

data

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

resource

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

Details

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.

Value

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

getIcuBeds.

Examples

# 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")
)

[Package babsim.hospital version 11.8.4 Index]