title: Scale kable table to fit page width
body: <p>How do you format a table in pdf using kable function? Because my output table width exceeds the width of the pdf. Here is an example:</p>
  
  <pre><code>---
  output: pdf_document
  ---
  
  ```{r}
  df &lt;- cbind(mtcars[1:5,], mtcars[1:5,])
  knitr::kable(df)
  ```
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/PSyjD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PSyjD.png" alt="enter image description here"></a></p>