View source: R/plotCharacteristics.R
plotCharacteristics | R Documentation |
plotCharacteristics(result, plotStyle = "barplot", facet = NULL, colour = NULL)
result |
A summariseCharacteristics result. |
plotStyle |
Either |
facet |
Columns to facet by. See options with |
colour |
Columns to color by. See options with |
A ggplot.
library(CohortCharacteristics)
library(dplyr, warn.conflicts = FALSE)
cdm <- mockCohortCharacteristics()
results <- summariseCharacteristics(
cohort = cdm$cohort1,
ageGroup = list(c(0, 19), c(20, 39), c(40, 59), c(60, 79), c(80, 150)),
tableIntersectCount = list(
tableName = "visit_occurrence", window = c(-365, -1)
),
cohortIntersectFlag = list(
targetCohortTable = "cohort2", window = c(-365, -1)
)
)
results |>
filter(
variable_name == "Cohort2 flag -365 to -1", estimate_name == "percentage"
) |>
plotCharacteristics(
plotStyle = "barplot",
colour = "variable_level",
facet = c("cdm_name", "cohort_name")
)
results |>
filter(variable_name == "Age", estimate_name == "mean") |>
plotCharacteristics(
plotStyle = "scatterplot",
facet = "cdm_name"
)
results |>
filter(variable_name == "Age") |>
plotCharacteristics(
plotStyle = "boxplot",
facet = "cdm_name",
colour = "cohort_name"
)
mockDisconnect(cdm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.