title: wrap text in knitr::kable table cell using "\n"
body: <p>How can I wrap a cell in a <code>knitr::kable</code> table cell using <code>\n</code>?</p>
  
  <hr>
  
  <p>I want to generate a .rmd file containing some tables where one column needs text wrapping. The places where the wrapping should occur are marked with <code>\n</code>. I tried (this is a standalone .rmd document):</p>
  
  <pre><code>---
  output: pdf_document
  ---
  
  ## A Table with text wrap
  
  ```{r cars}
  knitr::kable(data.frame(col1 = c("a", "b"), col2 = c("one\ntwo", "three\nfour")))
  ```
  </code></pre>
  
  <p>..but this doesn't work. Instead of staying in <code>col2</code>, the wrapped part lives on the next line of <code>col1</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/gXmCy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gXmCy.png" alt="enter image description here"></a></p>
  
  <p>Expected output is:</p>
  
  <pre><code>col1 | col2
  -------------
  a    | one
       | two
  b    | three
       | four
  </code></pre>
  
  <p>Solutions using other packages than <code>knitr</code> are welcome as long as they allow to print (nearly) as nice.</p>