如何在 Rmarkdown 中使用数据表 (DT) 设置按钮和 "Show Entries"?

How to have buttons and a "Show Entries" using Datatables (DT) in Rmarkdown?

我正在尝试制作一个既有显示条目又有按钮的 table,以便我的同事可以从 table.

中导出数据

起初,当我添加 tables 时,它覆盖了通常位于左上角的“显示条目”部分。所以我写了这个 CSS 代码,将按钮移动到 table 的中心,但我的“显示条目”部分仍然是空的。

这是我的 Rmarkdown 代码


输出:html_document

```{r}  

library(readr)
library(DT)

mtcars <- mtcars


    
  
```{css echo=FALSE}

.dataTables_wrapper .dt-buttons {
  float:none;  
  text-align:center;
}
datatable(mtcars,
          extensions = 'Buttons', options = list(
            dom = 'Bfrtip',
            buttons = c('copy','excel', 'pdf')
          )
) 

这就是我要加载的内容

如何添加“显示条目”功能?

使用dom = 'Blfrtip'代替dom = 'Bfrtip'