View source: R/plotCohortCount.R
plotCohortCount | R Documentation |
plotCohortCount(result, x = NULL, facet = c("cdm_name"), colour = NULL)
result |
A summarised_result object. Output of summariseCohortCount(). |
x |
Variables to use in x axis. |
facet |
Columns to facet by. See options with |
colour |
Columns to color by. See options with |
A ggplot.
library(CohortCharacteristics)
library(PatientProfiles)
library(dplyr, warn.conflicts = FALSE)
cdm <- mockCohortCharacteristics(numberIndividuals = 100)
counts <- cdm$cohort2 |>
addSex() |>
addAge(ageGroup = list(c(0, 29), c(30, 59), c(60, Inf))) |>
summariseCohortCount(strata = list("age_group", "sex", c("age_group", "sex"))) |>
filter(variable_name == "Number subjects")
counts |>
plotCohortCount(
x = "sex",
facet = cohort_name ~ age_group,
colour = "sex"
)
mockDisconnect(cdm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.