statquant
statquant

Reputation: 14360

How can I use kable or any other table package as default in Rmarkdown rendering

I am pretty sure that I've seen that it was possible to setup kable or some other Rstudio-supported table package as default when I rmarkdown:::render a Rmd document.

I cannot find if this is a yaml option or something that can be knitr::opts_chunk$set()

What I want is to stop having to do

```{r}
 table = f()
 table %>% head() %>% kable(table) # or something equivalent so the table is 'nicely' displayed 
```

Upvotes: 3

Views: 933

Answers (1)

Yihui Xie
Yihui Xie

Reputation: 30104

It depends on your output format (which you didn't mention). For example, for html_document, there is a df_print option, and you can set it to kable.

Upvotes: 5

Related Questions