create a ggplot from the output of summariseLargeScaleCharacteristics.
Source:R/plotCohortAttrition.R
plotCohortAttrition.Rd
`r lifecycle::badge("experimental")`
Examples
# \donttest{
library(omopgenerics)
#>
#> Attaching package: ‘omopgenerics’
#> The following objects are masked from ‘package:CDMConnector’:
#>
#> cdmName, recordCohortAttrition, uniqueTableName
#> The following object is masked from ‘package:stats’:
#>
#> filter
library(dplyr)
library(DiagrammeR)
cdm <- mockCohortCharacteristics(numberIndividuals = 1000)
#> ! cohort columns will be reordered to match the expected order:
#> cohort_definition_id, subject_id, cohort_start_date, and cohort_end_date.
#> ! cohort columns will be reordered to match the expected order:
#> cohort_definition_id, subject_id, cohort_start_date, and cohort_end_date.
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)
# }