
create a ggplot from the output of summariseLargeScaleCharacteristics.
Source:R/plotCohortAttrition.R
plotCohortAttrition.Rd
Usage
plotCohortAttrition(
result,
show = c("subjects", "records"),
type = "htmlwidget",
cohortId = lifecycle::deprecated()
)
Examples
# \donttest{
library(CohortCharacteristics)
library(omopgenerics)
#>
#> Attaching package: ‘omopgenerics’
#> The following object is masked from ‘package:stats’:
#>
#> filter
library(dplyr, warn.conflicts = FALSE)
library(clock)
cdm <- mockCohortCharacteristics(numberIndividuals = 1000)
#> Warning: There are observation period end dates after the current date: 2025-10-13
#> ℹ The latest max observation period end date found is 2038-08-17
cdm[["cohort1"]] <- cdm[["cohort1"]] |>
filter(get_year(cohort_start_date) >= 2000) |>
recordCohortAttrition("Restrict to cohort_start_date >= 2000") |>
filter(get_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()
# }