You can do this by using print
to print the kable output, setting the results="asis"
of the code chunk and then using kable_styling
from package kableExtra
.
This works for me:
```{r mtcars, results='asis'}library(kableExtra)library(knitr)make_outputs <- function(){ print(kable_styling(kable(head(mtcars)))) plot(mtcars$mpg, mtcars$cyl) hist(mtcars$cyl)}make_outputs()```