# NOT RUN {
data <- MASS::Cars93[20:49, c("Manufacturer", "Model", "MPG.city", "MPG.highway")]
## Stack text from one column with another column:
reactable(
data,
columns = list(
Manufacturer = colDef(name = "Manufacturer/Model",
cell = merge_column(data, merged_name = "Model"
)),
Model = colDef(show = FALSE)))
## Control the appearance of both the current and merged columns:
reactable(
data,
columns = list(
Manufacturer = colDef(name = "Manufacturer/Model",
cell = merge_column(data,
merged_name = "Model",
merged_size = 16,
merged_color = "blue",
merged_style = "italic",
size = 18,
color = "red"
)),
Model = colDef(show = FALSE)))
## Combine both numeric and non-numeric columns together:
reactable(
data,
columns = list(
Model = colDef(name = "Model/MPG Highway",
cell = merge_column(data,
merged_name = "MPG.highway",
merged_position = "below",
merged_size = 20,
merged_color = "green"
)),
MPG.highway = colDef(show = FALSE),
MPG.city = colDef(show = FALSE)))
# }
Run the code above in your browser using DataLab