Skip to contents

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

Usage

plotTrend(result, output = NULL, facet = "type", colour = NULL)

Arguments

result

A summarised_result object (output of summariseTrend).

output

The output to plot. Accepted values are: "record", "person", "person-days", "age", and "sex". If not specified, the function will default to:

  • the only available output if there is just one in the results, or

  • "record" if multiple outputs are present.

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)
library(OmopSketch)

cdm <- mockOmopSketch()

result <- summariseTrend(cdm,
  episode = "observation_period",
  output = c("person-days","record"),
  interval = "years",
  ageGroup = list("<=40" = c(0, 40), ">40" = c(41, Inf)),
  sex = TRUE
)

plotTrend(result, output = "record", colour = "sex", facet = "age_group")



PatientProfiles::mockDisconnect(cdm)
# }