Why the cable does not print when used in a function in rmarkdown

I have to repeat certain outputs in many rmarkdown reports and want to write a function that will be used for this.

The function call displays the graphs normally when I insert the rmd file, but not the enslaving data frames.

for instance

---
title: "Markdown example"
output: html_document
---

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

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

make_outputs()

```

Displays graphs, but not a kable table.

+4
source share

Source: https://habr.com/ru/post/1668735/


All Articles