calendar_plot {eesim}R Documentation

Create calendar plot

Description

Creates a calendar plot of a time series of continuous or discrete data. The time series data frame input to this function must have only two columns, one for the date and one with the values to plot.

Usage

calendar_plot(df, type = "continuous", labels = NULL,
  legend_name = "Exposure")

Arguments

df

Data frame with one column named date for date with entries in the format "yyyy-mm-dd" and one column for the daily values of the variable to plot.

type

Character string specifying whether the exposure is continuous or discrete

labels

Vector of character strings naming the levels of a discrete variable to be used in the figure legend.

legend_name

Character string specifying the title to be used in the figure legend.

Details

The output of this function is a ggplot object, so you can customize this output object as with any ggplot object.

Examples

testdat <- sim_exposure(n = 1000, central = 0.1,
           exposure_type = "binary")
testdat$x[c(89,101,367,500,502,598,678,700,895)] <- 3
calendar_plot(testdat, type = "discrete", labels = c("no", "yes", "maybe"))


[Package eesim version 0.1.0 Index]