title: How do you use kable to tidy up a data frame in Shiny output
body: <p>I have a data frame <code>df</code> with column names containing underscores. I would like to format it using <code>knitr::kable(df, ...)</code>. When this is used with <code>rmarkdown</code> you can pass it a list of nice column names, and it will also automatically spread the names over multiple lines to make the table fit on page.</p>
  
  <p>However, I am trying to use <code>kable</code> with Shiny. That is, I would like a <code>renderXXX()</code> type output to write to the <code>output</code> object so that I can call my nice table from <code>ui.R</code>. I've tried in <code>server.R</code>:</p>
  
  <pre><code>renderText(
  
     knitr::kable(df, format = "html")
  )
  </code></pre>
  
  <p>and in <code>ui.R</code>:</p>
  
  <pre><code>htmlOutput("results_table")
  </code></pre>
  
  <p>but this just leads to a very messy table.</p>