group_merge_sort: Hide rows containing duplicate values on sort. Must be placed...

View source: R/table_elements.R

group_merge_sortR Documentation

Hide rows containing duplicate values on sort. Must be placed within reactable::colDef(style). Credit to Greg Lin, creator of reactable for writing the JS function.

Description

Hide rows containing duplicate values on sort. Must be placed within reactable::colDef(style). Credit to Greg Lin, creator of reactable for writing the JS function.

Usage

group_merge_sort(col_name = NULL)

Arguments

col_name

Name of the column.

Value

a function that hides duplicate values on sort in a reactable table.

Examples

data <- MASS::Cars93[1:20, c("Manufacturer", "Model", "Type", "MPG.city")]

## Merge unique groups in a column:
reactable(data,
pagination = FALSE,
columns = list(Manufacturer = colDef(
style = group_merge_sort("Manufacturer")
))
)

## Works with columns containing numeric data as well:
reactable(data,
pagination = FALSE,
columns = list(MPG.city = colDef(
style = group_merge_sort("MPG.city")
))
)

reactablefmtr documentation built on March 18, 2022, 5:08 p.m.