Learn R Programming

CohortSymmetry (version 0.2.4)

plotTemporalSymmetry: A plot for the temporal symmetry of cohorts.

Description

It provides a ggplot of the temporal symmetry of two or more cohorts.

Usage

plotTemporalSymmetry(
  result,
  plotTitle = NULL,
  labs = c("Time (months)", "Individuals (N)"),
  xlim = c(-12, 12),
  colours = c("blue", "red"),
  scales = "free"
)

Value

A plot for the temporal symmetry of cohorts.

Arguments

result

Table output from summariseTemporalSymmetry.

plotTitle

Title of the plot, if NULL no title will be plotted.

labs

Axis labels for the plot.

xlim

Limits for the x axis of the plot.

colours

Colours for both parts of the plot, pre- and post- time 0.

scales

Whether to set free y scales for the facet wrap when there are multiple plots (i.e. each plot has its own scaled y axis) or set them equal for all. Only accepts "free" for the former and "fixed" for the latter.

Examples

Run this code
# \donttest{
library(CohortSymmetry)
cdm <- mockCohortSymmetry()
cdm <- generateSequenceCohortSet(cdm = cdm,
                                 indexTable = "cohort_1",
                                 markerTable = "cohort_2",
                                 name = "joined_cohort")
temporal_symmetry <- summariseTemporalSymmetry(cohort = cdm$joined_cohort)
plotTemporalSymmetry(result = temporal_symmetry)
CDMConnector::cdmDisconnect(cdm = cdm)
# }

Run the code above in your browser using DataLab