Back
The following is my data frame:
And my desired output is:
How can I achieve that using the Kable package?
In R programming, you can simply use the cell_spec() function in the kableExtra library as well as mutate() in the Dplyr package.
It would look something like this:
table <- df %>% mutate(Column = cell_spec(Column, "html", background_as_tile = T, background = factor(Column, colours))) %>% kable()...
table <- df %>%
mutate(Column = cell_spec(Column, "html", background_as_tile = T, background = factor(Column, colours))) %>%
kable()...
31k questions
32.8k answers
501 comments
693 users