File size: 1,216 Bytes
526ed7e
dcdfe4c
81645ef
526ed7e
dcdfe4c
81645ef
 
 
 
 
 
 
 
 
 
 
 
 
 
526ed7e
 
81645ef
 
 
 
 
 
 
526ed7e
81645ef
 
 
 
 
 
 
 
 
 
dcdfe4c
 
81645ef
526ed7e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
library(shiny)
library(shinythemes)
library(GWalkR)


ui <- fluidPage(
  title = "Data Explorer",
  theme = shinytheme("cyborg"),
  
  tags$h3(id = "title", tags$strong("Graphic-Walker Data Explorer"),style = "text-align:center;color:lightblue;"),
  sidebarLayout(
    sidebarPanel(width = 3, fileInput("target_upload",h5(strong("Click to Upload CSV File"),style = "color:lightblue;"),
                                      accept = c("text/csv"),
                                      placeholder = "No file selected"),
                 br(),br(),a(href = "https://github.com/Kanaries/GWalkR",h6("Learn More",style = "color:lightblue;"),target = "_blank",style = "text-decoration: none;")),
    mainPanel(gwalkrOutput(outputId = "explorer",width = "114%")
)
  )
      
)

server <- function(input,output,session){
  file_upload <- reactive({
    inFile <- input$target_upload
    if(is.null(inFile)){return(NULL)}
    data <- read.csv(inFile$datapath,header = TRUE,sep = ",")
    return(data)
  })
  
  output$explorer <- renderGwalkr({
    tryCatch(
      {
        gwalkr(file_upload())
      },
      error = function(e){
        message("Could not display interface")
      }
    )
  })
}

shinyApp(ui,server)