title: Creating good kable output in RStudio
body: <p>I've got a data frame that looks like this:</p>
  
  <pre><code>er.frame &lt;- structure(c(0.475, 0.525, 0.45, 0.475, 0.45, 0.55, 0.425, 0.5, 
  0.5, 0.4, 0.45, 0.375, 0.55, 0.425, 0.5, 0.475, 0.4, 0.45, 0.375, 
  0.55, 0.425), .Dim = c(7L, 3L), .Dimnames = list(NULL, c("CSP.LDA.error.rate", 
  "CSP.SWLDA.error.rate", "CSP.SVM.error.rate")))
  
  kable(er.frame)
  
  |  CSP.LDA.error.rate|  CSP.SWLDA.error.rate|  CSP.SVM.error.rate|
  |-------------------:|---------------------:|-------------------:|
  |               0.475|                 0.500|               0.500|
  |               0.525|                 0.500|               0.475|
  |               0.450|                 0.400|               0.400|
  |               0.475|                 0.450|               0.450|
  |               0.450|                 0.375|               0.375|
  |               0.550|                 0.550|               0.550|
  |               0.425|                 0.425|               0.425|
  </code></pre>
  
  <p>I'd like to have that <code>kable</code> output be processed by <code>knitr</code> and make a nice table in the HTML report. Following the documentation in <code>?kable</code>, I made this snippet:</p>
  
  <pre><code>``` {r snippet}
  opts_chunk$set(results='asis')
  kable(er.frame)
  ```
  </code></pre>
  
  <p>My HTML report, though, as generated by RStudio, is just the echoed console output (or nothing at all, if I add the option <code>output=FALSE</code>):</p>
  
  <pre><code>## |  CSP.LDA.error.rate|  CSP.SWLDA.error.rate|  CSP.SVM.error.rate|
  ## |-------------------:|---------------------:|-------------------:|
  ## |               0.425|                 0.400|               0.400|
  ## |               0.425|                 0.475|               0.500|
  ## |               0.400|                 0.400|               0.400|
  ## |               0.425|                 0.425|               0.425|
  ## |               0.425|                 0.325|               0.275|
  ## |               0.350|                 0.375|               0.375|
  ## |               0.450|                 0.425|               0.425|
  </code></pre>
  
  <p>The above is also what appears in the generated Markdown file with accompanying <code>```</code> delimiters, and it looks just fine if I remove the delimiters and the hashes.</p>
  
  <p>How do I properly output using <code>kable</code>? <a href="https://stackoverflow.com/questions/15488350/programmatically-creating-markdown-tables-in-r-with-knitr">This question's accepted answer hints at it</a>, but doesn't go as far as the documentation.</p>
  
  <p>Incidentally, I'm running R 2.15.1, knitr 1.5.15.</p>