Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. server <- function(input, output) {
  2.  
  3. rv <- reactiveValues(
  4. norm = rnorm(500),
  5. unif = runif(500),
  6. chisq = rchisq(500, 2))
  7.  
  8. observeEvent(input$renorm, { rv$norm <- rnorm(500) })
  9. observeEvent(input$reunif, { rv$unif <- runif(500) })
  10. observeEvent(input$rechisq, { rv$chisq <- rchisq(500, 2) })
  11.  
  12. output$norm <- renderPlot({
  13. hist(rv$norm, breaks = 30, col = "grey", border = "white",
  14. main = "500 random draws from a standard normal distribution")
  15. })
  16. output$unif <- renderPlot({
  17. hist(rv$unif, breaks = 30, col = "grey", border = "white",
  18. main = "500 random draws from a standard uniform distribution")
  19. })
  20. output$chisq <- renderPlot({
  21. hist(rv$chisq, breaks = 30, col = "grey", border = "white",
  22. main = "500 random draws from a Chi Square distribution with two degree of freedom")
  23. })
  24. }
  25.  
  26. shinyApp(server = server, ui = ui)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement