I want to upload multiple tables and display them separately.
For example: I would like to upload N tables (I don't know N in advance) and want to display them in the main panel as:
Table1:
Table2:
Table3:
.....
My code is shown below but it did not work. How to change it?
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
fileInput(
inputId = "calfile",
label = "Choose CSV File",
multiple = TRUE,
accept = c("text/csv",
"text/comma-separated-values,text/plain",
".csv")
)
),
mainPanel(
tableOutput("contents")
)
)
)
server <- function(input, output) {
data<-reactive({
if (is.null(input$calfile))
return()
else
{
nfile<-nrow(input$calfile)
csv=list()
for(i in 1: nfile)
{
csv[[i]]=read.csv(input$calfile$datapath[i])
}
}
})
output$contents<- renderTable(data())
}
shinyApp(ui, server)
Many thanks.