我正在使用 knitr 包中的 kable()
在 html 文档上显示表格。是否可以使其可排序?一些示例代码,
---
title: "Test"
output: html_document
---
```{r, echo=FALSE, comment=""}
kable(data.frame("a"=1:10,"b"=11:20),digits=2)
```
最佳答案
DT 包 ( https://github.com/rstudio/DT ) 是 JavaScript 库 DataTables 的 R 接口(interface)。您可以在 R Markdown 中使用它,例如
```{r}
DT::datatable(iris)
```
关于r - rMarkdown 中是否可以有可排序(交互式)表格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27120002/