Prepare data for plotting
prepare_plot_data.RdFilters and prepares data for plotting by selecting relevant records based on indicator, variant, and year. Also creates a control limit function for the filtered dataset.
Value
A list containing:
- plotdta
Filtered data.table for plotting
- calc_cl
Function to calculate control limits for the filtered data
Examples
if (FALSE) { # \dontrun{
# Prepare data for antipsychotic usage plot
plot_data <- prepare_plot_data(
dta = my_data,
config = list(dates = list(report = list(year = 2024))),
ind = "antipsychotics",
varant = "overall"
)
# Access the filtered data
plot_data$plotdta
# Use the control limit function
plot_data$calc_cl(100, 0.975)} # }