Closed Laurent-Smeets-GSS-Account closed 3 years ago
echarts4r does not support this tidyeval.
library(dplyr)
library(echarts4r)
# use the escape hatch
# functions ending in _
# they accept strings
chart_f_ <- function(y, size){
iris %>%
e_charts_("Petal.Width") %>%
e_scatter_(y, size, symbol_size = 5)
}
# run
chart_f_("Sepal.Width", "Petal.Length")
# use rlang if you want to have to use bare names
chart_f <- function(y, size){
y_label <- rlang::as_label(rlang::enquo(y))
size_label <- rlang::as_label(rlang::enquo(size))
iris %>%
e_charts(Petal.Width) %>%
e_scatter_(y_label, size_label, symbol_size = 5)
}
# run
chart_f(Sepal.Width, Petal.Length)
Let me know if this helps.
Thanks, this is perfect. Also great thanks for the amazing package.
I would like to use the echarts4r package inside a function. However, I am not able to get even these very basic examples working. Is something like this even possible in the current version? and if so, how?