Intellipaat 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 (107k 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()...

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...