JohnCoene / echarts4r

🐳 ECharts 5 for R
http://echarts4r.john-coene.com/
Other
585 stars 82 forks source link

Parallel plot via passing a vector of column names not working #566

Open AdrianAntico opened 10 months ago

AdrianAntico commented 10 months ago

It looks like the function was setup to accept a character vector of column names but tidyselect updated it's api so an error is being thrown... Looks like the suggested method should make for a quick fix. Instead of using data %>% select(v) you would now use data %>% select(all_of(v))

# Website version start 
df <- data.frame(
  price = rnorm(5, 10),
  amount = rnorm(5, 15),
  letter = LETTERS[1:5]
)

df |>
  e_charts() |>
  e_parallel(price, amount, letter, opts = list(smooth = TRUE))

# Website version end

# Test out passing in vector of names
df <- data.frame(
  price = rnorm(5, 10),
  amount = rnorm(5, 15),
  letter = LETTERS[1:5]
)

v <- c("price","amount","letter")

df |>
  e_charts() |>
  e_parallel_(v, opts = list(smooth = TRUE))

Warning message:
  Using an external vector in selections was deprecated in tidyselect 1.1.0.
ℹ Please use `all_of()` or `any_of()` instead.
# Was:
data %>% select(v)

# Now:
data %>% select(all_of(v))

See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.