Tomas R
Tomas R

Reputation: 556

How do I manually highlight cells by position (not by value) using kableExtra?

Note: I posted a similar question about this earlier Text, but asking for a different solution. I am still interested in that solution, but I am not sure it is possible.

My question: I have a data frame with around 8 columns and 35-40 rows. How can I highlight a specific cell by index/position? I know how to highlight a row or a column or cells that fulfill some logical statement (e.g larger than x).

How can I highlight a cell manually.

In the example below, I would like the b in the third row to be highlighted.

Note that I need to do this to about 2*30 different cells (two tables), so it can't be super complicated.

Note also that I do not want to highligh every b, just a specific b.

library(kableExtra)

df <- data.frame(date_one = c("a","b","c"),
                 date_two = c("a","b","b"))


df |> 
  kable(format = "latex")


Upvotes: 0

Views: 32

Answers (0)

Related Questions