Skip to content

Instantly share code, notes, and snippets.

@asbates
asbates / reactable-stacked-bar-chart.R
Created May 12, 2022 16:45
Create a stacked bar chart in a reactable cell with css flexbox
library(reactable)
library(htmltools)
# https://thomaswilburn.github.io/viz-book/css-flex.html
# was crucual to figuring this out. thanks Thomas!
bar_chart <-
function(value,
color_left = "#78c2ad",
color_right = "#f3969a",
@asbates
asbates / app.R
Created June 1, 2021 19:35
App that implements exercise 2 of Mastering Shiny section 14.4.5
# this app implements exercise 2 of section 14.4.5 in Mastering Shiny
# as you update the inputs, you can check how long the computation takes
# by seeing which of y1, y2, y3 changes
# example:
# change x1 and the time for y1 will be different from when app is initialized
# so it takes 1 second for graph to recompute when x1 changes
# exercise solution:
# when x1 changes: 1 second
# when x2 changes: 2 seconds