There is a great example: https://rstudio.github.io/DT/010-style.html that allows creating 19 breaks and 20 rgb color values ranging from "white" to "red":
library(DT)
# 1. Data
df = as.data.frame(cbind(matrix(round(rnorm(50), 3), 10), sample(0:1, 10, TRUE)))
# 2. Create 19 breaks and 20 rgb color values ranging from white to red
brks <- quantile(df, probs = seq(.05, .95, .05), na.rm = TRUE)
clrs <- round(seq(255, 40, length.out = length(brks) + 1), 0) %>%
{paste0("rgb(255,", ., ",", ., ")")}
# 3. DT
datatable(df) %>% formatStyle(names(df), backgroundColor =
styleInterval(brks, clrs))
But how make the same colorizing from "GREEN" to "RED" ?
Thanks!