calendar_plot: Create calendar plot

Description Usage Arguments Details Examples

View source: R/plots.R

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

1
2
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

1
2
3
4
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"))

eesim documentation built on June 4, 2017, 1:03 a.m.