Plot prevalence results
plotPrevalence.Rd
Plot prevalence results
Usage
plotPrevalence(
result,
x = "prevalence_start_date",
y = "prevalence",
line = FALSE,
point = TRUE,
ribbon = FALSE,
ymin = "prevalence_95CI_lower",
ymax = "prevalence_95CI_upper",
facet = NULL,
colour = NULL
)
Arguments
- result
Prevalence results
- x
Variable to plot on x axis
- y
Variable to plot on y axis.
- line
Whether to plot a line using
geom_line
- point
Whether to plot points using
geom_point
- ribbon
Whether to plot a ribbon using
geom_ribbon
- ymin
Lower limit of error bars, if provided is plot using
geom_errorbar
- ymax
Upper limit of error bars, if provided is plot using
geom_errorbar
- facet
Variables to use for facets. To see available variables for facetting use the function
availablePrevalenceGrouping()
.- colour
Variables to use for colours. To see available variables for colouring use the function
availablePrevalenceGrouping()
.
Examples
# \donttest{
cdm <- mockIncidencePrevalence(sampleSize = 1000)
cdm <- generateDenominatorCohortSet(
cdm = cdm, name = "denominator",
cohortDateRange = c(as.Date("2014-01-01"), as.Date("2018-01-01"))
)
#> ℹ Creating denominator cohorts
#> ! cohort columns will be reordered to match the expected order:
#> cohort_definition_id, subject_id, cohort_start_date, and cohort_end_date.
#> ✔ Cohorts created in 0 min and 2 sec
prev <- estimatePointPrevalence(
cdm = cdm,
denominatorTable = "denominator",
outcomeTable = "outcome"
)
#> ℹ Getting prevalence for analysis 1 of 1
#> ✔ Time taken: 0 mins and 0 secs
plotPrevalence(prev)
# }