File size: 1,709 Bytes
526ed7e
dcdfe4c
a68b13b
81645ef
526ed7e
a68b13b
 
 
 
 
dcdfe4c
81645ef
 
 
 
a68b13b
 
81645ef
a68b13b
81645ef
 
a68b13b
 
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
45
46
47
48
49
50
51
library(shiny)
library(shinythemes)
library(shinycssloaders)
library(GWalkR)

# set global options for spinner
options(spinner.size = 1,
        spinner.color.background = "#FFFFFF",
        spinner.color = "lightblue")


ui <- fluidPage(
  title = "Data Explorer",
  theme = shinytheme("cyborg"),
  tags$h3(id = "title", tags$strong("Graphic-Walker Data Explorer"),style = "text-align:center;color:lightblue;"),
  tags$a(href = "https://github.com/Ifeanyi55", tags$strong("Maintainer"),target = "_blank",style = "text-decoration:none;color:lightblue;margin-left:1250px;margin-bottom:1000px"),
  tags$img(src = "plot.jpeg",width = 170,height = 100),br(),br(),
  sidebarLayout(
    sidebarPanel(width = 3,style = "border-width:5px;border-color:lightblue;", 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(strong("Learn More"),style = "color:lightblue;"),target = "_blank",style = "text-decoration: none;")),
    mainPanel(withSpinner(gwalkrOutput(outputId = "explorer",width = "114%"),type = 1)
)
  )
      
)

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)