Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. #server.R
  2.  
  3. library(shiny)
  4. library(leaflet)
  5. file1 <- read.csv("data/Chelsea_Indicators_Fake.csv", header= TRUE, sep = ",",
  6. quote = "\"", dec = ".", fill = TRUE, comment.char = "")
  7. bare <- read.csv("data/blank.csv", header= TRUE, sep = ",",
  8. quote = "\"", dec = ".", fill = TRUE, comment.char = "")
  9. initialMatrixValue <- file1
  10. bMemory <- 0
  11.  
  12. shinyServer(function(input, output, session) {
  13. ##demo data logic chain##
  14. values <- reactiveValues(matrix = initialMatrixValue)
  15. observe({
  16. if (input$calcRisk == 0)
  17. return()
  18. array <- file1$riskarea + file1$callsforservice + file1$crime + file1$notifications
  19. values$matrix$risk_score <- array
  20. })
  21. output$table1 <- renderDataTable({
  22. values$matrix
  23. })
  24.  
  25. ##user uploaded data logic chain##
  26.  
  27. output$table2 <- renderDataTable({
  28. inFile <- input$file2
  29. if (is.null(inFile))
  30. return(bare)
  31. read.csv(inFile$datapath, header=input$header, sep=input$sep,
  32. quote=input$quote)
  33. })
  34. # m <- leaflet() %>% addTiles() %>%
  35.  
  36. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement