I have to repeat certain outputs in many rmarkdown reports and want to write a function to use for this.
Calling a function outputs plots ok when I knit the rmd file but not kable data frames.
For example
---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 the plots but not the kable table.