Learn R Programming

babsim.hospital (version 11.5.14)

plotDailyMaxResults: 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

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab