plotIncidence: Plot incidence time series using histograms

Description Usage Arguments Author(s) Examples

View source: R/plotIncidence.R

Description

This function provides advanced plotting facilities for incidence time series using ggplot2

Usage

1
2
3
4
plotIncidence(x, dates, bin = 7, fill.by = NULL, split.by = NULL,
  shade.by = NULL, start.at = NULL, stop.at = NULL, xlab = NULL,
  ylab = "Incidence", date.format = "%d %b %Y", angle = 45,
  xbreaks = "1 week", col.pal = 1)

Arguments

x

a data.frame containing the data to be plotted.

dates

a character string or an integer indicating which column contains the dates to use

bin

an integer indicating the size of the time window (in days) to use for the incidence computation

fill.by

a character string or an integer indicating which column to use to color the bars

split.by

a character string or an integer indicating which column to use to split the charts

shade.by

a character string or an integer indicating which column to use to shade the bars

start.at

a starting date for the incidence; defaults to the earliest date of the dataset

stop.at

a stoping date for the incidence; defaults to the latest date of the dataset

xlab

a label for the x axis

ylab

a label for the y axis

date.format

a character string indicating the format of the dates

angle

an integer indicating the angle of the dates

xbreaks

a character string indicating the time interval between vertical lines

col.pal

an integer between 1 and 8 indicating a color palette to be used; if NULL, the default color palette of ggplot2 is used

Author(s)

Thibaut Jombart thibautjombart@gmail.com

Examples

1
2
3
4
5
6
7
8
9
data("toy")
head(toy)

## basic plot
plotIncidence(toy, dates="dateOfOnset")

## change column indication, and bin size to 2 days
plotIncidence(toy, dates=1, bin=2)
plotIncidence(toy, dates=1, bin=2, split.by="gender", fill.by=3)

Hackout2/incidence documentation built on May 6, 2019, 9:47 p.m.