在rMarkdown中是否可以有可排序的(交互式)表? [英] Is it possible to have sortable (Interactive) table in rMarkdown?

查看:92
本文介绍了在rMarkdown中是否可以有可排序的(交互式)表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 knitr 包中的kable()在html文档上显示表格.是否可以使其排序?一些示例代码,

I am using kable() from knitr package to show a table on a html document. Is it possible to make it sortable? Some sample code,

---
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接口.您可以在R Markdown中使用它,例如

The package DT (https://github.com/rstudio/DT) is an R interface to the JavaScript library DataTables. You can use it in R Markdown, e.g.

```{r}
DT::datatable(iris)
```

这篇关于在rMarkdown中是否可以有可排序的(交互式)表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆