highlight_min {reactablefmtr} | R Documentation |
Highlights the minimum value in a column
Description
The 'highlight_min()' function assigns a font color and/or background color to the minimum value in a column. It should be placed within the style argument in reactable::colDef.
Usage
highlight_min(data, font_color = "red", highlighter = NULL)
Arguments
data |
Dataset containing at least one numeric column. |
font_color |
color to assign to minimum value in a column. Default color is red. |
highlighter |
color to assign the background of a cell containing minimum value in a column. |
Value
a function that applies a color to the minimum value in a column of numeric values.
Examples
data <- MASS::road[11:17, ]
## By default, the minimum value is bold with a red font color
reactable(data,
defaultColDef = colDef(
style = highlight_min(data)))
## Assign a different font color
reactable(data,
defaultColDef = colDef(
style = highlight_min(data,
font_color = "green")))
## Highlight the background of the cell for the minimum value in each column
reactable(data,
defaultColDef = colDef(
style = highlight_min(data,
highlighter = "yellow")))
[Package reactablefmtr version 2.0.0 Index]