Quantcast
Channel: why does kable not print when used within a function in rmarkdown - Stack Overflow
Viewing all articles
Browse latest Browse all 5

Answer by George Savva for why does kable not print when used within a function in rmarkdown

$
0
0

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()```

Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>