I am not new to shiny but definitely very bad at it as you are about to find out. I want to change this example so that the user can only select a .csv from a quite large list of individual .csv files that I have stored locally within the shiny folder ("./data").
(I think) this is easy at least for me if the choice was to be made among the different columns of a single .csv file.
Thank you in advance for your help
if (interactive()) {
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
fileInput("file1", "Choose CSV File",
accept = c(
"text/csv",
"text/comma-separated-values,text/plain",
".csv")
),
tags$hr(),
checkboxInput("header", "Header", TRUE)
),
mainPanel(
tableOutput("contents")
)
)
)
server <- function(input, output) {
output$contents <- renderTable({
# input$file1 will be NULL initially. After the user selects
# and uploads a file, it will be a data frame with 'name',
# 'size', 'type', and 'datapath' columns. The 'datapath'
# column will contain the local filenames where the data can
# be found.
inFile <- input$file1
if (is.null(inFile))
return(NULL)
read.csv(inFile$datapath, header = input$header)
})
}
shinyApp(ui, server)
}
Thanks for your help, your advice has been definetly helpful and sent me on the right path, but still I have not been able to implement it. I have posted a perhaps more reproducible example here with my latest attempt to figure it out: