Skip to contents

Create a plot from the output of summariseObservationPeriod().

Usage

plotObservationPeriod(
  result,
  variableName = "number subjects",
  plotType = "barplot",
  facet = "cdm_name"
)

Arguments

result

A summarised_result object.

variableName

The variable to plot it can be: "number subjects", "records per person", "duration" or "days to next observation period".

plotType

The plot type, it can be: "barplot", "boxplot" or "densityplot".

facet

Elements to facet by, it can be "cdm_name", "observation_period_ordinal", both or none.

Value

A ggplot2 object.

Examples

if (FALSE) { # \dontrun{
library(dplyr)
library(OmopSketch)

# Connect to a mock database
cdm <- mockOmopSketch()

result <- summariseObservationPeriod(cdm$observation_period)

result |>
  plotObservationPeriod()

PatientProfiles::cdmDisconnect(cdm)
} # }