highlight_col(c(NA, 0, 0.1,0.5, 1))
## used in combination with attr_style()
attr_style(color = highlight_col(c(NA, 0, 0.1,0.5, 1)))
## note that for background-color you need inversed quotes to deal
## with the hyphen in an argument name
attr_style(`background-color` = highlight_col(c(NA, 0, 0.1,0.5, 1)))
tag_attr(class = c(1, 2),
style = attr_style(`background-color` = highlight_col(c(FALSE,TRUE))))
Run the code above in your browser using DataLab