why does kable not print when used within a function in rmarkdown : <p>I have to repeat certain outputs in many rmarkdown reports and want to write a function to use for this.</p>

<p>Calling a function outputs plots ok when I knit the rmd file but not kable data frames.</p>

<p>For example</p>

<pre><code>---
title: "Markdown example"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# Markdown example
```{r mtcars}
make_outputs &lt;- function(){
  knitr::kable(head(mtcars))
  plot(mtcars$mpg, mtcars$cyl)
  hist(mtcars$cyl)
}

make_outputs()

```
</code></pre>

<p>Displays the plots but not the kable table.</p>
