Skip to content

Instantly share code, notes, and snippets.

@ChrisBeeley
Created May 30, 2022 12:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
library(sparkline)
library(formattable)
library(dplyr)
x = c(0, rep(1000, 5), rep(1000.000001, 5))
res <- mtcars |>
mutate(summary = as.character(
htmltools::as.tags(
sparkline(x, type = "bar",
colorMap = c("white", rep("green", 6), rep("red", 4)))
)
)) |>
formattable() |>
formattable::as.htmlwidget()
res$dependencies <- c(
res$dependencies,
htmlwidgets:::widget_dependencies("sparkline", "sparkline")
)
res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment