Skip to contents

Create a ggplot2 plot from the output of summariseInObservation().

Usage

plotInObservation(result, facet = NULL, colour = NULL)

Arguments

result

A summarised_result object (output of summariseInObservation).

facet

Columns to face by. Formula format can be provided. See possible columns to face by with: visOmopResults::tidyColumns().

colour

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

Value

A ggplot showing the table counts

Examples

# \donttest{
library(dplyr, warn.conflicts = FALSE)

cdm <- mockOmopSketch()

result <- summariseInObservation(
  cdm$observation_period,
  output = c("person-days","records"),
  ageGroup = list("<=40" = c(0, 40), ">40" = c(41, Inf)),
  sex = TRUE
)

result |>
  filter(variable_name == "Number person-days") |>
  plotInObservation(facet = "sex", colour = "age_group")
#> ! The following column type were changed:
#>  variable_level: from double to character


PatientProfiles::mockDisconnect(cdm)
# }