I’m trying to add a color scale to a numeric column in a more complicated dataset, but it won’t even work on iris – so I think I’m doing something wrong in the code or have a software problem.
library(tidyverse)
library(gt)
iris %>%
group_by(Species) %>%
summarise(sepal_avg_length = mean(Sepal.Length)) %>%
ungroup() %>%
gt() %>%
data_color()
iris %>%
group_by(Species) %>%
summarise(sepal_avg_length = mean(Sepal.Length)) %>%
ungroup() %>%
gt() %>%
data_color(
columns = sepal_avg_length,
method = "numeric",
palette = "Oranges"
)
Both of these give me various errors:
- Error in rlang::eval_tidy(colors, data_tbl) : object ” not found
- Error in data_color(., columns = sepal_avg_length, method = “numeric”, :
unused arguments (method = “numeric”, palette = “Oranges”)
I’m not sure why this error is appearing; any ideas or other methods to give a color scale to a numeric column?