Skip to content

Commit

Permalink
Remove select_measures argument from plotting function
Browse files Browse the repository at this point in the history
It seems like it's easier to select the measures before plotting the data in a separate operation by filtering the data. Therefore this argument is no longer needed
  • Loading branch information
milanwiedemann committed Oct 3, 2024
1 parent 7b19a7c commit 187b157
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions lib/functions/function_plot_measures.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#' Creates a line plot of measures over time, with customisable labels and colours.
#'
#' @param data A dataframe containing output from the OpenSAFELY measures framework
#' @param select_measures List of strings specifiying the names in the measure columns to be plotted.
#' @param select_interval_date Specify date variable interval_start or interval_end.
#' @param select_value The name of the column which contains the y-axis values: ratio, numerator, or denominator
#' @param title A string specifying the title of the plot.
Expand All @@ -20,7 +19,6 @@

plot_measures <- function(
data,
select_measures = NULL,
select_interval_date,
select_value,
title = NULL,
Expand All @@ -40,17 +38,6 @@ plot_measures <- function(
stop("Data does not have expected column(s): ", paste(missing_columns, collapse = ", "), call. = FALSE)
}

# Filter measure column for user-specified measure names
if (!is.null(select_measures)) {
# Test if selected measures exist in measures file
expected_measures <- unique(data$measure)
if (any(select_measures %in% expected_measures) == FALSE) {
stop("At least one of the selected measures is not available in the data", call. = FALSE)
}
data <- data %>%
filter(measure %in% select_measures)
}

plot_tmp <- ggplot(
data,
aes(
Expand Down

0 comments on commit 187b157

Please sign in to comment.