I am formatting a table using formattable:color_bar and would like to add a comma as a thousands separator as well as adjust the colour of the font.
For cells where I don't use color_bar I see how I can use cell_spec to change the font color but I don't know how to do it with cells that are using color_bar.
library(tidyverse)library(knitr)library(kableExtra)library(formattable)df <- tibble ( rank = c(1,2,3), tree = c("Norway Maple", "Honey Locust", "Colorado Blue Spruce"), number = c(74688, 24286, 21917))df %>% mutate( tree = cell_spec(tree, "html", color = "black"), number = color_bar()(number)) %>% kable("html", escape = F, align = c("l", "l")) %>% kable_styling(bootstrap_options = c("hover", "responsive", "condensed"), full_width = F, position = "float_left") %>% column_spec(3, width = "10cm")