Guest User

Untitled

a guest
Apr 26th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. library(shiny)
  2. library(datasets)
  3.  
  4. # Define server logic required to summarize and view the selected
  5. # dataset
  6. shinyServer(function(input, output) {
  7.  
  8. # Return the requested dataset
  9. datasetInput <- reactive({
  10. switch(input$dataset,
  11. "rock" = rock,
  12. "pressure" = pressure,
  13. "cars" = cars)
  14. })
  15.  
  16. # Generate a summary of the dataset
  17. output$summary <- renderPrint({
  18. dataset <- datasetInput()
  19. summary(dataset)
  20. })
  21.  
  22. # Show the first "n" observations
  23. output$view <- renderTable({
  24. head(datasetInput(), n = input$obs)
  25. })
  26. })
Add Comment
Please, Sign In to add comment