From 5376830f6b4837e46ad36f9dde139fc6f72dad08 Mon Sep 17 00:00:00 2001 From: Dr Nathan Green Date: Fri, 10 Jan 2025 11:24:43 +0000 Subject: [PATCH] replaced purrr:keep() with Filter(f = \(val)) because this is causing an error in the macOS GitHub Action --- R/ceac_plot_graph.R | 2 +- R/ceef_plot_graph.R | 3 +-- R/ceplane_plot_graph.R | 2 +- R/contour_graph.R | 2 +- R/eib_plot_graph.R | 3 ++- R/evppi_plot_ggplot.R | 3 ++- R/plot.bcea.R | 4 ++-- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/R/ceac_plot_graph.R b/R/ceac_plot_graph.R index 94892d2a..b24a97b7 100644 --- a/R/ceac_plot_graph.R +++ b/R/ceac_plot_graph.R @@ -134,7 +134,7 @@ ceac_ggplot <- function(he, graph_params <- helper_ggplot_params(he, graph_params) legend_params <- make_legend_ggplot(he, pos_legend) - theme_add <- purrr::keep(extra_params, is.theme) + theme_add <- Filter(f = \(val) ggplot2::is.theme(val), x = extra_params) ggplot(data_psa, aes(x = .data$k, y = .data$ceac)) + geom_line(aes(linetype = .data$comparison, diff --git a/R/ceef_plot_graph.R b/R/ceef_plot_graph.R index 9a60c46b..0b547b8c 100644 --- a/R/ceef_plot_graph.R +++ b/R/ceef_plot_graph.R @@ -36,8 +36,7 @@ ceef_plot_ggplot <- function(he, extra_args <- list(...) - opt_theme <- purrr::keep(extra_args, is.theme) - + opt_theme <- Filter(f = \(val) ggplot2::is.theme(val), x = extra_args) ceplane <- ggplot(ceef.points, aes(x = .data$x, y = .data$y)) if (add_dominance_region) { diff --git a/R/ceplane_plot_graph.R b/R/ceplane_plot_graph.R index d96c9289..203e604b 100644 --- a/R/ceplane_plot_graph.R +++ b/R/ceplane_plot_graph.R @@ -160,7 +160,7 @@ ceplane_plot_ggplot.bcea <- function(he, plot_params <- ceplane_ggplot_params(he, pos_legend, graph_params, ...) - theme_add <- purrr::keep(list(...), is.theme) + theme_add <- Filter(f = \(val) ggplot2::is.theme(val), x = list(...)) ggplot(delta_ce, aes(x = .data$delta_e, y = .data$delta_c, diff --git a/R/contour_graph.R b/R/contour_graph.R index 7390c286..6b00c90e 100644 --- a/R/contour_graph.R +++ b/R/contour_graph.R @@ -58,7 +58,7 @@ contour_ggplot <- function(he, plot_params <- contour_ggplot_params(he, graph_params, ...) - theme_add <- purrr::keep(list(...), is.theme) + theme_add <- Filter(f = \(val) ggplot2::is.theme(val), x = list(...)) # single long format for ggplot data delta_ce <- diff --git a/R/eib_plot_graph.R b/R/eib_plot_graph.R index c8147340..970cae3f 100644 --- a/R/eib_plot_graph.R +++ b/R/eib_plot_graph.R @@ -52,7 +52,8 @@ eib_plot_ggplot <- function(he, ##TODO: can we move this up a level? cri_params <- eib_params_cri(he, graph_params) - theme_add <- purrr::keep(extra_params, is.theme) + theme_add <- Filter(f = \(val) ggplot2::is.theme(val), x = extra_params) + legend_params <- make_legend_ggplot(he, graph_params$pos) graph_params <- eib_params_ggplot(he, graph_params, cri_params) diff --git a/R/evppi_plot_ggplot.R b/R/evppi_plot_ggplot.R index e0af3640..2da19670 100644 --- a/R/evppi_plot_ggplot.R +++ b/R/evppi_plot_ggplot.R @@ -27,7 +27,8 @@ evppi_plot_ggplot <- function(evppi_obj, evppi_obj$parameters), "EVPI")) - theme_add <- purrr::keep(extra_args, is.theme) + theme_add <- Filter(f = \(val) ggplot2::is.theme(val), x = extra_args) + size <- purrr::pluck(extra_args, "size", .default = c(1, 0.5)) legend_params <- make_legend_ggplot(evppi_obj, pos_legend) diff --git a/R/plot.bcea.R b/R/plot.bcea.R index bfc58b65..6867144c 100644 --- a/R/plot.bcea.R +++ b/R/plot.bcea.R @@ -168,9 +168,9 @@ plot.bcea <- function(x, extra_params, keep.null = TRUE) - theme_add <- purrr::keep(extra_args, is.theme) + theme_add <- Filter(f = \(val) ggplot2::is.theme(val), x = extra_args) - ceplane.pos <- ifelse(pos, pos, c(1, 1.025)) + ceplane.pos <- ifelse(pos, pos, c(1, 1.025)) ##TODO: warnings... ceplane <-