View source: R/plotCohortAttrition.R
plotCohortAttrition | R Documentation |
plotCohortAttrition(
result,
show = c("subjects", "records"),
type = "htmlwidget",
cohortId = lifecycle::deprecated()
)
result |
A summarised_result object. |
show |
Which variables to show in the attrition plot, it can be 'subjects', 'records' or both. |
type |
type of the output, it can either be: 'htmlwidget', 'png', or 'DiagrammeR'. |
cohortId |
deprecated. |
A grViz
visualisation.
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()
mockDisconnect(cdm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.