server.R 518 B

1234567891011121314151617181920212223
  1. # This is the server logic for a Shiny web application.
  2. # You can find out more about building applications with Shiny here:
  3. #
  4. # http://shiny.rstudio.com
  5. #
  6. library(shiny)
  7. shinyServer(function(input, output) {
  8. output$distPlot <- renderPlot({
  9. # generate bins based on input$bins from ui.R
  10. x <- faithful[, 2]
  11. bins <- seq(min(x), max(x), length.out = input$bins + 1)
  12. # draw the histogram with the specified number of bins
  13. hist(x, breaks = bins, col = 'darkgray', border = 'white')
  14. })
  15. })