I presently have a shiny app that allows me to navigate to ./data, select a .csv file of interest, and then perform necessary actions on the data in that file. When the user is finished, he/she can then select the next file and view output based upon those elements. A simplified version of the code is found below.
That said, I want to present the user with a list of category names linked to respective .csv files, from which they can select from a dropdown menu. Their menu selection would result in loading the associated .csv file, and render desired outcomes on screen. But, I am not finding a viable solution. How would I adapt the following code so that the user can select source data file from a single dropdown selection?
Thanks, Matt
library("DT")
library("data.table")
library("shiny")
githubinstall("shinytest")
ui <- fluidPage(
sidebarPanel (
fileInput("file1",
label=HTML("<font size=3>Select File</font>"),
multiple=FALSE,
accept=c("text/csv",
"text/comma-separated-values,text/plain",
".csv")),
mainPanel(
textOutput("text1"))))
server <- function(input,output) {
output$text1 <- renderText({
inFile <- input$file1
if (is.null(inFile)){
return(NULL)
}
file1=read.csv(inFile$datapath,header=TRUE, sep=",")
paste(file1$gradyear)
})
}
shinyApp(ui, server)