server.R 1.36 KB
Newer Older
Stephanie's avatar
Stephanie committed
1 2 3 4 5 6 7 8 9 10
#
# This is the server logic of a Shiny web application. You can run the 
# application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
# 
#    http://shiny.rstudio.com/
#

library(shiny)
11
library(jsonlite)
12
#library(DT)
Stephanie's avatar
Stephanie committed
13

Stephanie's avatar
Stephanie committed
14 15
server <- function(input, output) {
  set.seed(122)
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
  
  output$file1 <- renderDataTable({
    
      inFile <- input$file1
      if (is.null(inFile))
        return(NULL)
    
      json_data_coco <- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE) 
      coconut.df <- json_data_coco[["data"]]
    
    #coconut.df$timestamp <- anytime((as.numeric(coconut.df$timestamp)/1000))
    
    
    
  })
  
  output$file2 <- renderDataTable({
    inFile <- input$file2
34 35
    if (is.null(inFile))
      return(NULL)
36 37 38 39 40
    scrollX=TRUE
    json_data_quest <- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE) 
    
    print("json_data_quest ")
    print(json_data_quest)
41 42 43 44 45 46 47 48 49
    
  })
  
  #data<-reactive({
  #file1 <- input$file1
  #if(is.null(file1)){return()}
  #read_json(file1=file1$datapath)
  #})
  
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
  #histdata <- rnorm(500)
  
  #output$plot1 <- renderPlot({
  #data <- histdata[seq_len(input$slider)]
  #hist(data)
  #})
  
  ##MAP 
  
  #m <- leaflet()
  #m <- addTiles(m)
  #x=1
  #for(x in 1:2019){
  #m <- addMarkers(m,lng=longitude[x], lat=latitude[x]) #addPolylines does not work
  #x=x+1}
  #m
  #}
Stephanie's avatar
Stephanie committed
67
}