plotTimeToEvent( cohortMethodData, population = NULL, outcomeId = NULL, firstExposureOnly = FALSE, restrictToCommonPeriod = FALSE, washoutPeriod = 0, removeDuplicateSubjects = "keep all", minDaysAtRisk = 1, riskWindowStart = 0, startAnchor = "cohort start", riskWindowEnd = 0, endAnchor = "cohort end", censorAtNewRiskWindow = FALSE, periodLength = 7, numberOfPeriods = 52, highlightExposedEvents = TRUE, includePostIndexTime = TRUE, showFittedLines = TRUE, targetLabel = "Target", comparatorLabel = "Comparator", title = NULL, fileName = NULL )
If specified, this population will be used as the starting
point instead of the cohorts in the
The ID of the outcome. If NULL, no outcome-specific transformations will be performed.
(logical) Should only the first exposure per subject be included?
(logical) Restrict the analysis to the period when both exposures are observed?
The minimum required continuous observation time prior to index date for a person to be included in the cohort.
Remove subjects that are in both the target and comparator cohort? See details for allowed values.
The minimum required number of days at risk.
The start of the risk window (in days) relative to the
The anchor point for the start of the risk window. Can be
The end of the risk window (in days) relative to the
The anchor point for the end of the risk window. Can be
If a subject is in multiple cohorts, should time-at-risk be censored when the new time-at-risk starts to prevent overlap?
The length in days of each period shown in the plot.
Number of periods to show in the plot. The periods are equally divided before and after the index date.
(logical) Highlight event counts during exposure in a different color?
(logical) Show time after the index date?
(logical) Fit lines to the proportions and show them in the plot?
A label to us for the target cohort.
A label to us for the comparator cohort.
Optional: the main title for the plot.
Name of the file where the plot should be saved, for example
ggplot2::ggsave() for supported file formats.
A ggplot object. Use the
ggplot2::ggsave() function to save to file in a different
Creates a plot showing the number of events over time in the target and comparator cohorts, both before and after
index date. The plot also distinguishes between events inside and outside the time-at-risk period. This requires
the user to (re)specify the time-at-risk using the same arguments as the
Note that it is not possible to specify that people with the outcome prior should be removed, since the plot will
show these prior events.