How can I render a text column containing the output of {sparkline}s' spk_chr()
with {reactable}?
Note that I do not want to use the way described in the docs (https://glin.github.io/reactable/articles/examples.html), but explicitly use spk_chr()
output.
Here is a reprex:
library(dplyr)
library(sparkline)
data <- chickwts %>%
count(feed)
summary_table <- data.frame(
x = "obs 1",
spark = spk_chr(
data$n,
barWidth = 500,
barSpacing = 100,
height = 50,
width = 300,
type = "bar",
tooltipFormatter = htmlwidgets::JS(
sprintf(
"function(sparkline, options, field){
debugger;
return 'value=' + %s[field[0].offset] + '<br/> n=' + field[0].value;
}",
jsonlite::toJSON(
data$feed
)
)
)
)
)
reactable(summary_table) #I want to render the spark column