Skip to content

Commit

Permalink
Remove lazyeval import (inspired by tidyverse/ggplot2@d9f2cd4#diff-43…
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Nov 23, 2023
1 parent 5b6cc1c commit ffa1878
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 13 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Imports:
dplyr,
vctrs,
tibble,
lazyeval (>= 0.2.0),
rlang (>= 0.4.10),
crosstalk,
purrr,
Expand Down
6 changes: 1 addition & 5 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,12 @@ importFrom(httr,write_disk)
importFrom(jsonlite,parse_json)
importFrom(jsonlite,read_json)
importFrom(jsonlite,toJSON)
importFrom(lazyeval,all_dots)
importFrom(lazyeval,f_eval)
importFrom(lazyeval,f_new)
importFrom(lazyeval,is_formula)
importFrom(lazyeval,is_lang)
importFrom(magrittr,"%>%")
importFrom(purrr,transpose)
importFrom(rlang,"!!!")
importFrom(rlang,"!!")
importFrom(rlang,eval_tidy)
importFrom(rlang,is_formula)
importFrom(rlang,is_na)
importFrom(stats,complete.cases)
importFrom(stats,is.leaf)
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## Improvements

* `ggplotly()` now works better with the development version of ggplot2 (> v3.4.4). (#2315)
* plotly no longer imports lazyeval (@olivroy, #2319)


# 4.10.3

Expand Down Expand Up @@ -1342,3 +1344,4 @@ For ggplotly:

Merge ggplotly code.

# 0.3.5
4 changes: 2 additions & 2 deletions R/ggplotly.R
Original file line number Diff line number Diff line change
Expand Up @@ -1120,10 +1120,10 @@ gg2list <- function(p, width = NULL, height = NULL,
mappingFormulas <- lapply(layers, function(x) {
mappings <- getAesMap(plot, x)
if (originalData) {
lapply(mappings, lazyeval::f_new)
lapply(mappings, function(x) rlang::new_formula(lhs = NULL, rhs = x))
} else {
nms <- names(mappings)
setNames(lapply(nms, function(x) lazyeval::f_new(as.name(x))), nms)
setNames(lapply(nms, function(x) rlang::new_formula(lhs = NULL, rhs = as.name(x))), nms)
}
})

Expand Down
3 changes: 1 addition & 2 deletions R/imports.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
#' @importFrom jsonlite toJSON parse_json read_json
#' @importFrom httr RETRY content config add_headers authenticate stop_for_status warn_for_status write_disk
#' @importFrom htmlwidgets createWidget sizingPolicy saveWidget onRender prependContent
#' @importFrom lazyeval f_eval is_formula all_dots is_lang f_new
#' @importFrom tibble as_tibble
#' @importFrom htmltools browsable tagList tags div
#' @importFrom purrr transpose
#' @importFrom tools file_ext file_path_sans_ext
#' @importFrom data.table as.data.table setorderv
#' @importFrom rlang eval_tidy !! !!!
#' @importFrom rlang eval_tidy !! !!! is_formula
NULL


Expand Down
4 changes: 2 additions & 2 deletions R/plotly_build.R
Original file line number Diff line number Diff line change
Expand Up @@ -1003,9 +1003,9 @@ traceify <- function(dat, x = NULL) {
return(new_dat)
}


# Previously used lazyeval #2319
eval_attr <- function(x, data = NULL) {
if (lazyeval::is_formula(x)) lazyeval::f_eval(x, data) else x
if (rlang::is_formula(x)) rlang::eval_tidy(rlang::f_rhs(x), data = data) else x
}

# overwrite defaults with the user defined palette
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ verify_key_type <- function(p) {
p$x$data[[i]]$`_isSimpleKey` <- TRUE
p$x$data[[i]]$`_isNestedKey` <- FALSE
}
p$x$data[[i]]$`_isNestedKey` <- p$x$data[[i]]$`_isNestedKey` %||% !lazyeval::is_atomic(k)
p$x$data[[i]]$`_isNestedKey` <- p$x$data[[i]]$`_isNestedKey` %||% !rlang::is_atomic(k)
# key values should always be strings
if (p$x$data[[i]]$`_isNestedKey`) {
p$x$data[[i]]$key <- lapply(p$x$data[[i]]$key, function(x) I(as.character(x)))
Expand Down

0 comments on commit ffa1878

Please sign in to comment.