Old Faithful Eruptions

knitr::opts_chunk$set(echo = FALSE)
faithful_data <- faithful[sample(nrow(faithful), 100), ]

Column {.sidebar}

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)

Column

Geyser Eruption Duration

plotOutput("eruptions")
output$eruptions <- renderPlot({
  hist(faithful_data$eruptions, probability = TRUE,
       breaks = as.numeric(input$n_breaks),
       xlab = "Duration (minutes)", main = "Geyser Eruption Duration")

  dens <- density(faithful_data$eruptions, adjust = input$bw_adjust)
  lines(dens, col = "blue")
})


Try the shinytest package in your browser

Any scripts or data that you put into this service are public.

shinytest documentation built on March 31, 2023, 11:09 p.m.