Skip to content

Commit

Permalink
replaced map_lgl usage with unname(sapply(c("ggplot2", "grid"), requi…
Browse files Browse the repository at this point in the history
…reNamespace, quietly = TRUE))

weirdly, the macOS-latest GitHub action is erroring (and all of the others are fine)
  • Loading branch information
n8thangreen committed Jan 2, 2025
1 parent 46cd2ba commit da3aa71
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ importFrom(purrr,keep)
importFrom(purrr,list_cbind)
importFrom(purrr,map)
importFrom(purrr,map_int)
importFrom(purrr,map_lgl)
importFrom(purrr,pluck)
importFrom(reshape2,melt)
importFrom(rlang,.data)
Expand Down
4 changes: 2 additions & 2 deletions R/plot.bcea.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#' [ceac.plot()],
#' [evi.plot()]
#' @importFrom Rdpack reprompt
#' @importFrom purrr map_lgl
#'
#' @references
#'
Expand Down Expand Up @@ -130,7 +129,8 @@ plot.bcea <- function(x,
})
} else {

is_req_pkgs <- map_lgl(c("ggplot2","grid"), requireNamespace, quietly = TRUE)
is_req_pkgs <- unname(sapply(c("ggplot2", "grid"),
requireNamespace, quietly = TRUE))

if (!all(is_req_pkgs)) {
message("falling back to base graphics\n")
Expand Down
5 changes: 2 additions & 3 deletions R/select_plot_type.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#' @param graph Type names; string
#' @return Plot ID integer 1:base R; 2:ggplot2; 3:plotly
#' @importFrom cli cli_alert_warning
#' @importFrom purrr map_lgl
#' @keywords dplot internal
#'
select_plot_type <- function(graph) {
Expand All @@ -16,8 +15,8 @@ select_plot_type <- function(graph) {
graph_lup <- c(base = 1, ggplot2 = 2, plotly =3)
graph_type <- graph_lup[graph]

is_req_pkgs <- purrr::map_lgl(c("ggplot2", "grid"),
requireNamespace, quietly = TRUE)
is_req_pkgs <- unname(sapply(c("ggplot2", "grid"),
requireNamespace, quietly = TRUE))

if (graph_type == 2 && !all(is_req_pkgs)) {
cli::cli_alert_warning(
Expand Down

0 comments on commit da3aa71

Please sign in to comment.