0.1 Sparklines with reactable

library(reactable)
library(dplyr)
library(sparkline)
# inspect the chickwts data
str(chickwts)
## 'data.frame':    71 obs. of  2 variables:
##  $ weight: num  179 160 136 227 217 168 108 124 143 140 ...
##  $ feed  : Factor w/ 6 levels "casein","horsebean",..: 2 2 2 2 2 2 2 2 2 2 ...
chickwts_grouped <- chickwts %>%
  group_by(feed) %>%
  summarise(weight = list(weight)) %>%
  mutate(boxplot = NA, sparkline = NA)

listviewer::jsonedit(listdata = chickwts_grouped, mode = "view")
reactable(chickwts_grouped,
  columns = list(
    weight = colDef(cell = function(values) {
      sparkline(
        values = values, type = "bar",
        chartRangeMin = 0,
        chartRangeMax = max(chickwts$weight)
      )
    }),
    boxplot = colDef(cell = function(value, index) {
      sparkline(
        values = data$weight[[index]],
        type = "box"
      )
    }),
    sparkline = colDef(cell = function(value, index) {
      sparkline(data$weight[[index]])
    })
  )
)