Skip to contents

Create a plot from the output of summariseObservationPeriod().

Usage

plotObservationPeriod(
  result,
  variableName = "Number subjects",
  plotType = "barplot",
  facet = NULL,
  colour = NULL,
  style = "default"
)

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

Columns to colour by. See possible columns to colour by with: visOmopResults::tidyColumns().

colour

Columns to colour by. See possible columns to colour by with: visOmopResults::tidyColumns().

style

Which style to apply to the plot, options are: "default", "darwin" and NULL (default ggplot style). Customised styles can be achieved by modifying the returned ggplot object.

Value

A ggplot2 object.

Examples

# \donttest{
library(OmopSketch)

cdm <- mockOmopSketch(numberIndividuals = 100)

result <- summariseObservationPeriod(observationPeriod = cdm$observation_period)
#> Warning: The `observationPeriod` argument of `summariseObservationPeriod()` is
#> deprecated as of OmopSketch 0.5.1.
#>  Please use the `cdm` argument instead.
#>  retrieving cdm object from cdm_table.
#> Warning: These columns contain missing values, which are not permitted:
#> "period_type_concept_id"

plotObservationPeriod(result = result,
    variableName = "Duration in days",
    plotType = "boxplot"
  )


PatientProfiles::mockDisconnect(cdm)
# }