cellspec_lgl {eHDPrep}R Documentation

Kable logical data highlighting


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 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:

  1. non-logical cells are coloured black)

  2. TRUE cells are coloured red (default) or green if rg is TRUE

  3. FALSE cells are coloured cyan (default) or red if rg is TRUE

  4. NA cells are coloured gray

Note: When passed to kable(), the escape parameter should be FALSE for colours to be rendered correctly.


Table with cell colours specified.

See Also

kable cell_spec

[Package eHDPrep version 1.3.3 Index]