如何在Rmarkdown渲染中使用kable或任何其他表包作为默认值

时间:2021-03-26 08:58:13

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.

我很确定我已经看到,当我rmarkdown :::渲染Rmd文档时,可以设置kable或其他一些Rstudio支持的表包作为默认值。

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

我无法找到这是一个yaml选项还是可以是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 
```

1 个解决方案

#1


2  

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.

这取决于您的输出格式(您没有提到)。例如,对于html_document,有一个df_print选项,您可以将其设置为kable。

#1


2  

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.

这取决于您的输出格式(您没有提到)。例如,对于html_document,有一个df_print选项,您可以将其设置为kable。