Is there any way to display multiple tables in Rshiny when the number of tables changes case by case? I want to create a Rshiny app which can read multiple csv files and display multiple tables corresponding to each csv file. However, the number of files provided will be different case by case.
The code I have written so far can read multiple files and store them in reactive values list but I don't know what the app should do in term of the output. here is my codes:
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
fileInput("upload", "Upload a file", multiple=TRUE)
),
mainPanel(
tableOutput("table")
)
)
)
server <- function(input, output, session) {
data <- reactive({
req(input$upload)
files <- reactiveValues()
browser()
for (i in 1:length(input$upload$datapath)){
files[[paste0(i)]] <- read.csv(input$upload$datapath[i])
}
return(files)
})
output$table <- renderTable({
data()
})
}
shinyApp(ui, server)```