Adds colour highlighting to cell values if they are encoded as logical
values. Output should then be passed to knitr
's kable
function.
cellspec_lgl(.data, rg = FALSE)
Table with cell colours specified.
Table to be highlighted.
Should red and green be used for TRUE
and FALSE
values, respectively? If FALSE (default), colour-blind-friendly colours are applied.
This is useful for identifying the encoding used in a value (e.g. the
difference between the string "TRUE" and truth value of logic TRUE
).
This highlighting can also be useful when visually assessing cell values in
a table. The colour naming format (HTML or LaTeX) is automatically detected.
There are four cell types considered:
non-logical cells are coloured black)
TRUE
cells are coloured red (default) or green if rg
is TRUE
FALSE
cells are coloured cyan (default) or red if rg
is TRUE
NA
cells are coloured gray
Note: When passed to kable()
, the escape
parameter should be
FALSE
for colours to be rendered correctly.
kable
cell_spec