inst/shiny/hist/app.R

library("shiny")

server <- function(input, output) {
  output$distPlot <- renderPlot({
    breaks <- seq(min(faithful$eruptions), max(faithful$eruptions), len=input$nbin+1)
    hist(faithful$eruptions, breaks=breaks, 
         xlab="Eruption time", ylab="Frequency", main="Old Faithful geyser")
  })
}

ui <- fluidPage(
  sidebarLayout(
    sidebarPanel(
      sliderInput("nbin", "Number of bins:", min = 2, max = 50, value = 20)
    ),
    mainPanel(plotOutput("distPlot"))
  )
)

shinyApp(ui = ui, server = server)

Try the demoShiny package in your browser

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

demoShiny documentation built on March 26, 2020, 7:34 p.m.