Plot a raw case counts as a histogram
Usage
plot_cases(
raw,
...,
mapping = .check_for_aes(raw, ..., class_aes = "fill"),
events = i_events
)Arguments
- raw
The raw case data either as a summarised count or as a line-list - EITHER: a dataframe with columns:
count (positive_integer) - Positive case counts associated with the specified time frame
time (ggoutbreak::time_period + group_unique) - A (usually complete) set of singular observations per unit time as a `time_period`
Any grouping allowed.
OR with columns:
time (ggoutbreak::time_period) - A set of events with a timestamp as a `time_period`
Any grouping allowed.
- ...
Named arguments passed on to
geom_eventseventsSignificant events or time spans - a dataframe with columns:
label (character) - the event label
start (date) - the start date, or the date of the event
end (date) - the end date or NA if a single event
Any grouping allowed.
A default value is defined.
- mapping
a
ggplot2::aesmapping. Most importantly setting thefillto something if there are multiple types of event in the plot. If aclasscolumn is present the mapping will default to using this.- events
Significant events or time spans - a dataframe with columns:
label (character) - the event label
start (date) - the start date, or the date of the event
end (date) - the end date or NA if a single event
Any grouping allowed.
A default value is defined.
Examples
# 50 random times:
tmp = dplyr::tibble(
time = as.time_period( sample.int(10,50,replace=TRUE) ,"1 day"),
class = rep(c("one","two","three"), length.out=50)
)
if(interactive()) {
plot_cases(tmp)
}
