Ifeanyi's picture
Update app.R
81645ef verified
raw
history blame
1.22 kB
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)