Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in R Programming by (50.2k points)

The following is my data frame:

enter image description here

And my desired output is:

enter image description here

How can I achieve that using the Kable package?

1 Answer

0 votes
by (108k points)

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()...

Browse Categories

...