error displaying multiple tables

I am trying to create an app in R shiny. The first thing I would like to do is select two csv files to display on a page. According to this: Creating tables in R shiny dynamically I need to add a dataTableOutput for each table in the UI and another renderDataTable in my server. However, the app doesn't work when I try to load multiple files. My code is below.

X <- c("plyr", "dplyr", "tm", "wordcloud", "SnowballC", "stringdist", "tidytext",
   "rmarkdown", "knitr", "quanteda", "qdap", "reshape", "stringr", "RecordLinkage", 
   "data.table", "rvest", "shiny", "shinydashboard", "DT")
lapply(X, FUN = function(X){"library", list(X))


ui <- dashboardPage(
  dashboardHeader(title = "Record Linkage App"),
  ## Tab 1 -- Specify Task
  menuItem("Select Task And Upload Files", tabName = "task", icon = icon("file-text-o")),
  ## Tab 2 -- View Raw Data Files
  menuItem("View Raw Data", tabName = "raw", icon = icon("file-text-o")),
  ## Tab 3 -- View Processed Data Files
  menuItem("View Processed Data", tabName = "processed", icon = icon("file-text-o")),
  ## Tab 4 -- Select Training Set
  menuItem("Select Training Set", tabName = "mltrain", icon = icon("file-text-o")),
  ## Tab 5 -- View Weight & Probabilities (choose which chart to view or both?)
  menuItem("Visualize Distributions", tabName = "distributions", icon = icon("bar-chart-o")),
  ## Tab 6 -- View Results (review, match and trash files--need to be able to choose dataset)
  ## Want to be able to add checkboxes to select rows for inclusion in deletion later on
  menuItem("View Result Files", tabName = "fileview", icon = icon("file-text-o"))
)), # close dashboard sidebar

  #### Dashboard Body starts here

  ### Specify Task & Upload Files Tab
  tabItem(tabName = "task",
          radioButtons("task", "Select a Task:", c("Frame Deduplication", "Frame Record Linkage")),
          fileInput("selection", "Upload Files:", multiple = T, 
                    accept = c(".xls", "text/csv", "text/comma-separated-values, text/plain", ".csv")),
          helpText(paste("Please upload a file.  Supported file types are:  .txt, .csv and .xls.")),
          helpText(paste("Note:  Record Linkage requires two data frames."))
          ), # close first tabItem
  tabItem(tabName = "raw",
          helpText(paste("This tab displays the raw, unprocessed data frames selected in the previous tab.")),
          helpText(paste("Select the columns you wish to display.  These columns will be used for string comparisons")),

) # close tabItems
  ) # close dashboardBody
) #close dashboardpage
options(shiny.maxRequestSize = 100*1024^2)


server <- function(input, output, session) {
  output$contents <- renderDataTable({


  output$contents <- renderDataTable({



shinyApp(ui, server)

My question is:

  1. what is the best way to load and display multiple data tables? I would like to continue with the dashboard layout above.
  2. Can someone explain why when I select multiple files nothing shows up on the "raw" tab?

Thanks for your help, I really appreciate it.

I think the simplest way to go about this is to use insertUI():


ui <- fluidPage(
  fileInput("file", "Upload"),

server <- function(input, output, session) {
  getData <- reactive({
  observeEvent(getData(), {
      ui = htmltools::as.tags(

shinyApp(ui, server)

If you need actual output bindings for each dataset, then it gets more complicated, but it's possible

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.