Guest User

Untitled

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