library(shiny) # load data in 'global' chunk so it can be shared by all users of the dashboard library(datasets) data(faithful)
Waiting time between eruptions and the duration of the eruption for the Old Faithful geyser in Yellowstone National Park, Wyoming, USA.
selectInput("n_breaks", label = "Number of bins:", choices = c(10, 20, 35, 50), selected = 20) sliderInput("bw_adjust", label = "Bandwidth adjustment:", min = 0.2, max = 2, value = 1, step = 0.2)
renderPlot({ hist(faithful$eruptions, probability = TRUE, breaks = as.numeric(input$n_breaks), xlab = "Duration (minutes)", main = "Geyser Eruption Duration") dens <- density(faithful$eruptions, adjust = input$bw_adjust) lines(dens, col = "blue") })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.