Color only specific rows

Hi All,

In the below example, both 2nd and 3rd row (of 2nd column) is getting colored. Is there a way to color only 3rd row of 2nd column that is ( only "B is larger than 2")

Note : Column "A is less than 1" is a character

library(tibble)
library(DT)

dat <- tribble(
  ~`A/B`,                ~`A is less than 1`, ~`A is between 1 and 2`,  ~`A is larger than 2`,
  "B is less than 1",                    "Less than 1,                      30,                     30,
  "B is between 1 and 2",                 20,                      10,                     30,
  "B is larger than 2",                   20,                      20,                     10
)


datatable(dat, filter = "none", rownames = FALSE, selection = "none",
          options = list(dom = 't', ordering = FALSE)) %>% 
  formatStyle(
  'A is less than 1',
   backgroundColor = styleEqual(20, "orange")
)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.