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

View source: R/plotCohortAttrition.R

plotCohortAttritionR Documentation

create a ggplot from the output of summariseLargeScaleCharacteristics.

Description

[Experimental]

Usage

plotCohortAttrition(result, cohortId = lifecycle::deprecated())

Arguments

result

A summarised_result object. Output of summariseCohortAttrition().

cohortId

deprecated.

Value

A grViz visualisation.

Examples


library(CohortCharacteristics)
library(omopgenerics)
library(dplyr, warn.conflicts = FALSE)

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")

result <- summariseCohortAttrition(cdm$cohort1)

result |>
  filter(group_level == "cohort_2") |>
  plotCohortAttrition(cohortId = 2)

mockDisconnect(cdm)



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