title: Render data frame into a Table output in shiny
body: <p>I would like to render the data frame calculated in <code>table.data</code> into a table output in <code>shiny</code>. I tried using <code>randerDataTable</code> and <code>renderTable</code> but that didn't work. I must have been missing something. I would appreciate guidance on how to render the data frame into a table output underneath the plot.
  Here is a running example.</p>
  <pre><code>library(shiny)
  library(data.table)
  library(flexsurv)
  #load some data
  data(pbc, package=&quot;randomForestSRC&quot;)
  data &lt;- as.data.table(na.omit(pbc))
  data[, years := days/365.25]
  
  fit &lt;- flexsurvspline(Surv(years, status) ~ albumin, data=data, k=1, scale='hazard')
  
  ui &lt;- fluidPage(
      fluidRow(
          column(12, h1('TITLE'), align='middle')
      ),
      hr(),
      sidebarLayout(
          sidebarPanel(
              sliderInput('COVAL', 'Covariate value', min=1, max=5, value=3, step=1), 
              align = 'left', 
          ),
          mainPanel(
              plotOutput('PLOT', height = 600, width = 600),
              tableOutput('TABLE')
          )#mainpanel
      )#sidebarLayout
  )#fluidPage
  
  
  server &lt;- function(input, output) {
      
      table.data &lt;- reactive({
          ndata &lt;- data.frame(albumin = input[[&quot;COVAL&quot;]])
          prob=summary(fit,type='survival',newdata=ndata, t=12)
          prob=as.data.frame(matrix(unlist(prob),nrow = length(prob),byrow = TRUE))
          table.data &lt;- as.data.frame(prob)
          return(table.data)
      })#reactive
      
      output$PLOT &lt;- renderPlot({
          ndata &lt;- data.frame(albumin = input[[&quot;COVAL&quot;]])
          plot(fit, est=FALSE, ci=FALSE, col.obs = 'white')
          lines(fit, newdata = ndata, ci=FALSE, col = 'green')
      })
      
      #renderTable({table.data()}) #not working
      renderDataTable(table.data())  #not working
      
  }
  
  shinyApp(ui, server)
  </code></pre>