Create a ggplot from the output of summariseCharacteristics. `r lifecycle::badge("deprecated")`
Source:R/plotCharacteristics.R
plotCharacteristics.Rd
Create a ggplot from the output of summariseCharacteristics. `r lifecycle::badge("deprecated")`
Usage
plotCharacteristics(
data,
xAxis = "variable_name",
yAxis = "estimate_value",
plotStyle = "barplot",
facetVarX = NULL,
facetVarY = NULL,
colorVars = NULL,
vertical_x = FALSE
)
Arguments
- data
output of summariseCharacteristics.
- xAxis
what to plot on x axis, default as variable_name column. Has to be a column in data.
- yAxis
what to plot on y axis, default as estimate_value column. Has to be a column in data. One of the xAxis or yAxis has to be estimate_value.
- plotStyle
Now allows boxplot or barplot only.
- facetVarX
column in data to facet by on horizontal axis
- facetVarY
column in data to facet by on vertical axis
- colorVars
column in data to color by.
- vertical_x
whether to display x axis string vertically.
Examples
# \donttest{
library(PatientProfiles)
cdm <- mockPatientProfiles()
results <- summariseCharacteristics(
cohort = cdm$cohort1,
ageGroup = list(c(0, 19), c(20, 39), c(40, 59), c(60, 79), c(80, 150)),
tableIntersect = list(
tableName = "visit_occurrence", value = "count", window = c(-365, -1)
),
cohortIntersect = list(
targetCohortTable = "cohort2", value = "flag", window = c(-365, -1)
)
)
#> ℹ adding demographics columns
#> ℹ adding table intersect columns for table: visit_occurrence
#> ℹ adding cohort intersect columns for table: cohort2
#> ℹ summarising data
#> ℹ The following estimates will be computed:
#> • flag_variable_00018_variable_00017: count, percentage
#> • flag_variable_00019_variable_00017: count, percentage
#> • variable_00011: count, percentage
#> • variable_00015: count, percentage
#> • cohort_start_date: min, q05, q25, median, q75, q95, max
#> • cohort_end_date: min, q05, q25, median, q75, q95, max
#> • variable_00013: min, q05, q25, median, q75, q95, max, mean, sd
#> • variable_00014: min, q05, q25, median, q75, q95, max, mean, sd
#> • variable_00012: min, q05, q25, median, q75, q95, max, mean, sd
#> • count_visit_occurrence_variable_00016: min, q05, q25, median, q75, q95, max,
#> mean, sd
#> ! Table is collected to memory as not all requested estimates are supported on
#> the database side
#> → Start summary of data, at 2024-05-11 12:03:38.04902
#> ✔ Summary finished, at 2024-05-11 12:03:38.203064
#> ✔ summariseCharacteristics finished!
plotCharacteristics(results)
#> Warning: facetVarX put as NULL, plot overall
#> Warning: facetVarY put as NULL, plot overall
CDMConnector::cdmDisconnect(cdm = cdm)
# }