Skip to contents

Plot incidence results

Usage

plotIncidence(
  result,
  x = "incidence_start_date",
  y = "incidence_100000_pys",
  ylim = c(0, NA),
  ribbon = FALSE,
  facet = NULL,
  colour = NULL,
  options = list()
)

Arguments

result

Incidence results

x

Variable to plot on x axis

y

Variable to plot on y axis. Options are: "incidence_100000_pys", "outcome_count", "denominator_count", "person_days"

ylim

Limits for the Y axis

ribbon

If TRUE, the plot will join points using a ribbon

facet

Variables to use for facets

colour

Variables to use for colours

options

A list of optional plot options. See optionsPlot() for the default parameters.

Value

A ggplot with the incidence results plotted

Examples

# \donttest{
cdm <- mockIncidencePrevalence(sampleSize = 1000)
cdm <- generateDenominatorCohortSet(
  cdm = cdm, name = "denominator",
  cohortDateRange = c(as.Date("2008-01-01"), as.Date("2018-01-01"))
)
#>  Creating denominator cohorts
#>  Cohorts created in 0 min and 3 sec
inc <- estimateIncidence(
  cdm = cdm,
  denominatorTable = "denominator",
  outcomeTable = "outcome"
)
#> Getting incidence for analysis 1 of 1
#> Overall time taken: 0 mins and 1 secs
plotIncidence(inc)

# }