plotComparedLargeScaleCharacteristics: create a ggplot from the output of...

View source: R/plotComparedLargeScaleCharacteristics.R

plotComparedLargeScaleCharacteristicsR Documentation

create a ggplot from the output of summariseLargeScaleCharacteristics.

Description

[Experimental]

Usage

plotComparedLargeScaleCharacteristics(
  result,
  reference,
  missings = 0,
  facet = NULL,
  colour = NULL
)

Arguments

result

A summarised_result object. Output of summariseLargeScaleCharacteristics().

reference

A named character to set up the reference.

missings

Value to replace the missing value with. If NULL missing values will be eliminated.

facet

Columns to facet by. See options with tidyColumns(result). Formula is also allowed to specify rows and columns.

colour

Columns to color by. See options with tidyColumns(result).

Value

A ggplot.

Examples

## Not run: 
library(CohortCharacteristics)
library(duckdb)
library(CDMConnector)
library(DrugUtilisation)
library(plotly, warn.conflicts = FALSE)

con <- dbConnect(duckdb(), eunomiaDir())
cdm <- cdmFromCon(con, cdmSchem = "main", writeSchema = "main")

cdm <- generateIngredientCohortSet(
  cdm = cdm, name = "my_cohort", ingredient = "acetaminophen"
)

resultsLsc <- cdm$my_cohort |>
  summariseLargeScaleCharacteristics(
    window = list(c(-365, -1), c(1, 365)),
    eventInWindow = "condition_occurrence"
  )

resultsLsc |>
  plotComparedLargeScaleCharacteristics(
    reference = c(variable_level = "-365 to -1"),
    colour = "variable_name",
    missings = NULL
  ) |>
  ggplotly()

cdmDisconnect(cdm)

## End(Not run)


CohortCharacteristics documentation built on Oct. 1, 2024, 5:08 p.m.