plotDailyMaxResults: plotDailyMaxResults

View source: R/plotDailyMaxResults.R

plotDailyMaxResultsR Documentation

plotDailyMaxResults

Description

Plot output from getDailyMax().

Usage

plotDailyMaxResults(
  results,
  labels = c("babsim", "DIVI"),
  title = "Betten: Tuerkis = Readfssldaten, Rot = Simulation",
  showBeds = FALSE,
  icuDataRegion = NULL
)

Arguments

results

Results from getDailyMax.

labels

Axes labels (vector). Default: c('babsim', 'DIVI')

title

Title. Default: 'Betten: Tuerkis = Realdaten, Rot = Simulation'

showBeds

should normal beds be shown in the plot?

icuDataRegion

regional icudata

Value

This function returns a ggplot object.

Examples

set.seed(123)
# 1. Generate simulation data based on number of infected persons per day:
x <- dataCovidBeds20200624
StartDate <- x$Day[1]
EndDate <- x$Day[length(x$Day)]
arrivalTimes <- getArrivalTimes(x$Infected)
para <- babsimHospitalPara()
conf <- babsimToolsConf()
y <- babsimHospital(
  arrivalTimes = arrivalTimes,
  conf = conf,
  para = para
)

# 2. Extract real data:
fieldEvents <- getRealBeds(
  data = babsim.hospital::dataCovidBeds20200624,
  resource = c("bed", "intensiveBed", "intensiveBedVentilation")
)
conf <- babsimToolsConf()
# 3. Combine simlated and real data:
res <- getDailyMaxResults(
  envs = y,
  fieldEvents = fieldEvents,
  conf = conf
)
# 4. Plot results
p <- plotDailyMaxResults(res)
# print(p)

babsim.hospital documentation built on May 30, 2022, 9:05 a.m.