pacman::p_load(shiny)
binner <- function(dataset) {
require(shiny)
ui = fluidPage(
sidebarLayout(
sidebarPanel(sliderInput("n", "Bins", 5, 100, 20)),
mainPanel(plotOutput("hist"))
)
)
server = function(input, output) {
output$hist <- renderPlot(
ggplot(dataset, aes(x = eruptions)) + geom_histogram(bins = input$n)
)
source("helpers.R")
}
shinyApp(ui, server)
}
binner(dataset = faithful)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.