I have multiple text files that I imported into shiny as a list.
#ui
library(shiny)
fluidPage(
sidebarLayout(
sidebarPanel(
fileInput("file1", "Choose File",
multiple = TRUE,
accept = c("text/csv",
"text/comma-separated-values,text/plain",
".dp_txt", ".is_txt")),
),
mainPanel(
tableOutput("files"),
)
)
)
#server
function(input, output, session){
output$files <- renderTable({
req(input$file1)
library(readr)
files <- lapply(input$file1$datapath, function(x) read_csv(x))
files
})
}
I want to be able to select the different elements of this list and display them as tables. How can I individually output each table within my list in shiny (i.e., let the user select which table they want to display)? Every element (table) within the list will have a name. Can I use somehow use selectInput() to call each table within the list according to that tables name? Thanks in advance!