I have this table in a .RMD file and I would like to render in PDF with conditional formatting. Currently I am using pandoc. How can this be done with xtable?
table = data.frame(category = c("A","B","C"), groupA = c(.2,.3,.5), groupB= c(.6,.7,.9))
table
pandoc.table(table,split.table = Inf,keep.line.breaks = TRUE)
----------------------------
category groupA groupB
---------- -------- --------
A 0.2 0.6
B 0.3 0.7
C 0.5 0.9
----------------------------
How can I color the cells of the "groupA" and "groupB" columns with conditional formatting like:
>0 and <= .2 = "green"
>.2 and <= .3 = "red"
>.3 and <= .4 = "blue"
>.4 and <= .5 = "orange"
>.5 and <= .6 = "yellow"
>.6 and <= .7 = "black"
>.7 and <= .8 = "brown"
>.8 = "white"
See Question&Answers more detail:os