Commit f06cdde1 authored by Stephanie's avatar Stephanie
Browse files

coconut.json upload and reading works

parent 704e8bcf
Loading
Loading
Loading
Loading
+24 −16
Original line number Diff line number Diff line
@@ -9,27 +9,35 @@

library(shiny)
library(jsonlite)
#library(DT)

server <- function(input, output) {
  set.seed(122)
  output$data <- renderTable({
  
  output$file1 <- renderDataTable({
    
      inFile <- input$file1
      if (is.null(inFile))
        return(NULL)
    
    #read.csv(inFile$datapath, header = input$header)
      json_data_coco <- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE) 
      coconut.df <- json_data_coco[["data"]]
    
    print("filename: ")
    print(inFile$name)
    print("filepath: ")
    print(inFile$datapath)
    #coconut.df$timestamp <- anytime((as.numeric(coconut.df$timestamp)/1000))
    
    json_file <- paste(inFile$datapath,inFile$name, sep="") 
    json_data_coco <- fromJSON(paste(json_file, sep = ""), flatten = TRUE) 
    prin("json_data_coco")
    print(json_data_coco)
    
    
  })
  
  output$file2 <- renderDataTable({
    inFile <- input$file2
    if (is.null(inFile))
      return(NULL)
    scrollX=TRUE
    json_data_quest <- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE) 
    
    print("json_data_quest ")
    print(json_data_quest)
    
  })
  
+7 −3
Original line number Diff line number Diff line
@@ -46,10 +46,14 @@ ui <- dashboardPage(
      
      #show data tab content
      tabItem(tabName = "data",
              
                h2("CoConUT Data here:"),
              textOutput("data"),
              h2("CoCoQuest Data here:")
                
              dataTableOutput("file1"),
               
                
                h2("CoCoQuest Data here:"),
                dataTableOutput("file2")
              
      ),