plotCohortAttrition {CohortCharacteristics}R Documentation

create a ggplot from the output of summariseLargeScaleCharacteristics.

Description

'r lifecycle::badge("experimental")'

Usage

plotCohortAttrition(x, cohortId = NULL)

Arguments

x

attrition table

cohortId

target cohort_definition_id

Value

A dgr_graph

Examples


library(omopgenerics)
library(dplyr)
library(DiagrammeR)

cdm <- mockCohortCharacteristics(numberIndividuals = 1000)

cdm[["cohort1"]] <- cdm[["cohort1"]] |>
  filter(year(cohort_start_date) >= 2000) |>
  recordCohortAttrition("Restrict to cohort_start_date >= 2000") |>
  filter(year(cohort_end_date) < 2020) |>
  recordCohortAttrition("Restrict to cohort_end_date < 2020") |>
  compute(temporary = FALSE, name = "cohort1")

cdm$cohort1 |>
  summariseCohortAttrition() |>
  plotCohortAttrition(cohortId = 2)



[Package CohortCharacteristics version 0.2.2 Index]