| Title: | Interactive Plotting for Funnel, Sigma, and Statistical Process Control Charts |
|---|---|
| Description: | Generate interactive funnel plots, multi-indicator sigma charts, and statistical process control ('SPC') charts. Chart calculation and plotting use JavaScript, allowing dynamic charts without a Shiny server. For more details see Spiegelhalter (2004) <doi:10.1002/sim.1970> and Pfadt & Wheeler (1995) <doi:10.1901/jaba.1995.28-349>. |
| Authors: | Andrew R. Johnson [aut, cre] (ORCID: <https://orcid.org/0000-0001-7000-8065>), Healthcare Quality Intelligence Unit (Western Australia Health) [aut] |
| Maintainer: | Andrew R. Johnson <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.27 |
| Built: | 2026-10-21 07:55:21 UTC |
| Source: | https://github.com/AUS-DOH-Safety-and-Quality/controlcharts |
Generate interactive Funnel chart
funnel( data, keys, numerators, denominators, indicators = NULL, tooltips = NULL, labels = NULL, aggregations = NULL, title = NULL, canvas_settings = NULL, funnel_settings = NULL, misc_settings = NULL, outlier_settings = NULL, scatter_settings = NULL, line_settings = NULL, x_axis_settings = NULL, y_axis_settings = NULL, label_settings = NULL, summary_table_settings = NULL, tooltip_settings = NULL, width = NULL, height = NULL, elementId = NULL, return_objs = c("html_plot", "static_plot", "limits") )funnel( data, keys, numerators, denominators, indicators = NULL, tooltips = NULL, labels = NULL, aggregations = NULL, title = NULL, canvas_settings = NULL, funnel_settings = NULL, misc_settings = NULL, outlier_settings = NULL, scatter_settings = NULL, line_settings = NULL, x_axis_settings = NULL, y_axis_settings = NULL, label_settings = NULL, summary_table_settings = NULL, tooltip_settings = NULL, width = NULL, height = NULL, elementId = NULL, return_objs = c("html_plot", "static_plot", "limits") )
data |
A data frame containing the data for the chart. |
keys |
A vector or column name representing the categories of the chart. |
numerators |
A numeric vector or column name representing the numerators for each category. |
denominators |
A numeric vector or column name representing the denominators for each category. |
indicators |
Optional vector or list of vectors identifying indicators. Supplying indicators displays a multi-indicator sigma chart using the native Funnel visual. Each indicator is calculated against its comparison population. |
tooltips |
A vector or column name, or a list of them, representing
additional tooltips for each category. Each is labelled by its name in the
list, or else by the expression supplied. |
labels |
A vector or column name representing the labels
for each category. |
aggregations |
A list of aggregation function names for each field if multiple values are provided for each key. Valid options are:
Defaults to |
title |
Optional title to be added to the top of the chart. It can be a character string for the title text only, or a list with the following options:
|
canvas_settings |
Optional list of settings for the canvas,
see |
funnel_settings |
Optional list of settings for the Funnel chart,
see |
misc_settings |
Optional native MISC settings. |
outlier_settings |
Optional list of settings for outliers,
see |
scatter_settings |
Optional list of settings for scatter points,
see |
line_settings |
Optional list of settings for lines,
see |
x_axis_settings |
Optional list of settings for the x-axis,
see |
y_axis_settings |
Optional list of settings for the y-axis,
see |
label_settings |
Optional list of settings for labels,
see |
summary_table_settings |
Optional list of settings for the summary table,
see |
tooltip_settings |
Optional list of settings for tooltips,
see |
width |
Optional width of the chart in pixels. If NULL (default), the chart will fill the width of its container. |
height |
Optional height of the chart in pixels. If NULL (default), the chart will fill the height of its container. |
elementId |
Optional HTML element ID for the chart. |
return_objs |
Character vector of object types to return. Valid values are:
When |
An object of class controlchart containing the
interactive plot, static plot, limits data frame, and a function to save the plot.
Limits and limit lines include every group, with supplied indicator columns
included by name. Multi-indicator limits also include direction-adjusted scores.
Limits include the typed key, named after the keys expression and duplicated as key,
and tooltip columns by name.
Limit lines describe denominator curves and have no observation keys or tooltips.
Empty input returns empty limits and limit lines, without plots.
Get default settings for Funnel charts Retrieve the default settings for Funnel charts or a specific settings group.
funnel_default_settings(group = NULL)funnel_default_settings(group = NULL)
group |
Optional. A specific settings group to retrieve. If NULL, all settings groups are returned. |
A list of default settings for Funnel charts or the specified settings group.
#' # Get all default settings for Funnel charts funnel_default_settings() # # Get default settings for a specific group funnel_default_settings("x_axis")#' # Get all default settings for Funnel charts funnel_default_settings() # # Get default settings for a specific group funnel_default_settings("x_axis")
Output and render functions for using wrapper within Shiny applications and interactive Rmd documents.
funnelOutput(outputId, width = "100%", height = "400px") renderfunnel(expr, env = parent.frame(), quoted = FALSE)funnelOutput(outputId, width = "100%", height = "400px") renderfunnel(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width, height
|
Must be a valid CSS unit (like |
expr |
An expression that generates a wrapper |
env |
The environment in which to evaluate |
quoted |
Is |
Interactive Shiny widget for funnel plot
Interactive Shiny widget for funnel plot
Delegates to funnel() with indicator columns and a selected group.
Calculations, rendering, settings, and interactivity use the native Funnel visual.
misc( data, keys, numerators, denominators, indicators, target, ..., misc_settings = NULL )misc( data, keys, numerators, denominators, indicators, target, ..., misc_settings = NULL )
data |
A data frame containing the data for the chart. |
keys |
A vector or column name representing the categories of the chart. |
numerators |
A numeric vector or column name representing the numerators for each category. |
denominators |
A numeric vector or column name representing the denominators for each category. |
indicators |
A vector or list of vectors identifying indicators. |
target |
A single value from |
... |
Additional arguments passed to |
misc_settings |
Native MISC settings, with |
An object of class controlchart, as returned by funnel().
The plot displays target; limits include every group and separate indicator
columns. Request "limit_lines" in return_objs for each indicator's curves.
comparison <- data.frame( organisation = rep(LETTERS[1:4], 2), indicator = rep(c("Measure A", "Measure B"), each = 4), numerator = c(8, 5, 4, 6, 2, 4, 5, 3), denominator = 10 ) misc( comparison, keys = organisation, numerators = numerator, denominators = denominator, indicators = indicator, target = "A", return_objs = "limits" )comparison <- data.frame( organisation = rep(LETTERS[1:4], 2), indicator = rep(c("Measure A", "Measure B"), each = 4), numerator = c(8, 5, 4, 6, 2, 4, 5, 3), denominator = 10 ) misc( comparison, keys = organisation, numerators = numerator, denominators = denominator, indicators = indicator, target = "A", return_objs = "limits" )
Get default settings for multi-indicator sigma charts
misc_default_settings(group = NULL)misc_default_settings(group = NULL)
group |
Optional settings group. If |
Native Funnel settings used by misc().
Shiny bindings for multi-indicator sigma charts
miscOutput(outputId, width = "100%", height = "400px") renderMisc(expr, env = parent.frame(), quoted = FALSE)miscOutput(outputId, width = "100%", height = "400px") renderMisc(expr, env = parent.frame(), quoted = FALSE)
outputId |
Output variable to read from. |
width, height
|
Valid CSS dimensions. |
expr |
An expression that generates a MISC chart. |
env |
Environment in which to evaluate |
quoted |
Whether |
An interactive Funnel widget displaying a MISC chart.
Generate interactive SPC chart
spc( data, keys, numerators, denominators, groupings, indicators = NULL, xbar_sds, tooltips = NULL, labels = NULL, aggregations = NULL, title = NULL, canvas_settings = NULL, spc_settings = NULL, outlier_settings = NULL, nhs_icon_settings = NULL, scatter_settings = NULL, line_settings = NULL, x_axis_settings = NULL, y_axis_settings = NULL, date_settings = NULL, label_settings = NULL, summary_table_settings = NULL, tooltip_settings = NULL, width = NULL, height = NULL, elementId = NULL, return_objs = c("html_plot", "static_plot", "limits") )spc( data, keys, numerators, denominators, groupings, indicators = NULL, xbar_sds, tooltips = NULL, labels = NULL, aggregations = NULL, title = NULL, canvas_settings = NULL, spc_settings = NULL, outlier_settings = NULL, nhs_icon_settings = NULL, scatter_settings = NULL, line_settings = NULL, x_axis_settings = NULL, y_axis_settings = NULL, date_settings = NULL, label_settings = NULL, summary_table_settings = NULL, tooltip_settings = NULL, width = NULL, height = NULL, elementId = NULL, return_objs = c("html_plot", "static_plot", "limits") )
data |
A data frame containing the data for the chart. |
keys |
A vector or column name representing the categories (x-axis) of the chart. |
numerators |
A numeric vector or column name representing the numerators for each category. |
denominators |
A numeric vector or column name representing the
denominators for each category. Optional for |
groupings |
A vector or column name representing the grouping for each category. |
indicators |
A vector or list of vectors representing indicator categories for the summary table. |
xbar_sds |
A numeric vector or column name representing the x-bar and standard deviation values for each category. |
tooltips |
A vector or column name, or a list of them, representing
additional tooltips for each category. Each is labelled by its name in the
list, or else by the expression supplied. |
labels |
A vector or column name representing the labels for each
category. |
aggregations |
A list of aggregation function names for each field if multiple values are provided for each key. Valid options are:
Defaults to |
title |
Optional title to be added to the top of the chart. It can be a character string for the title text only, or a list with the following options:
|
canvas_settings |
Optional list of settings for the canvas,
see |
spc_settings |
Optional list of settings for the SPC chart,
see |
outlier_settings |
Optional list of settings for outliers,
see |
nhs_icon_settings |
Optional list of settings for NHS icons,
see |
scatter_settings |
Optional list of settings for scatter points,
see |
line_settings |
Optional list of settings for lines,
see |
x_axis_settings |
Optional list of settings for the x-axis,
see |
y_axis_settings |
Optional list of settings for the y-axis,
see |
date_settings |
Optional list of settings for dates,
see |
label_settings |
Optional list of settings for labels,
see |
summary_table_settings |
Optional list of settings for the summary table,
see |
tooltip_settings |
Optional list of settings for tooltips,
see |
width |
Optional width of the chart in pixels. If NULL (default), the chart will fill the width of its container. |
height |
Optional height of the chart in pixels. If NULL (default), the chart will fill the height of its container. |
elementId |
Optional HTML element ID for the chart. |
return_objs |
Character vector of object types to return. Valid values are:
When |
An object of class controlchart containing the
interactive plot, static plot, limits, and a function to save the plot.
Limits are a flat data frame. Supplied indicator columns are included by name.
xbar and s limits include each group's size as denominator.
The key column is named after the keys expression and retains its type.
It is duplicated as key for compatibility.
Tooltip columns are included by name.
Empty input returns empty limits with typed keys and tooltips, without plots.
Retrieve the default settings for SPC charts or a specific settings group.
spc_default_settings(group = NULL)spc_default_settings(group = NULL)
group |
Optional. A specific settings group to retrieve. If NULL, all settings groups are returned. |
A list of default settings for SPC charts or the specified settings group.
#' # Get all default settings for SPC charts spc_default_settings() # # Get default settings for a specific group spc_default_settings("x_axis")#' # Get all default settings for SPC charts spc_default_settings() # # Get default settings for a specific group spc_default_settings("x_axis")
Output and render functions for using wrapper within Shiny applications and interactive Rmd documents.
spcOutput(outputId, width = "100%", height = "400px") renderSpc(expr, env = parent.frame(), quoted = FALSE)spcOutput(outputId, width = "100%", height = "400px") renderSpc(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width, height
|
Must be a valid CSS unit (like |
expr |
An expression that generates a wrapper |
env |
The environment in which to evaluate |
quoted |
Is |
Interactive Shiny widget for SPC chart
Interactive Shiny widget for funnel plot