reactable:基于React Table的R交互式数据表格,支持排序、筛选、分组与自定义渲染

Interactive data tables for R

分支20Tags12

反应式表格(Reactable)

CRAN状态
构建状态
Codecov代码覆盖
生命周期

基于React Table库和使用reactR开发的R语言交互式数据表。

特性

  • 排序、过滤、分页
  • 分组与聚合
  • 内置列格式化
  • 支持通过R语言或JavaScript自定义渲染——可以在表格中使用Shiny HTML标签和HTML小部件
  • 可展开行与嵌套表格
  • 条件样式设置
  • 在R Markdown文档和Shiny应用中无缝工作

示例应用

安装

你可以从CRAN安装reactable:

install.packages("reactable")

或者,从GitHub安装开发版本:

# 如果尚未安装devtools,则需先安装
# install.packages("devtools")
devtools::install_github("glin/reactable")

使用

创建表格时,直接对数据框或矩阵使用reactable()函数:

library(reactable)
reactable(iris)

你可以将其嵌入到R Markdown或Quarto文档中:

```{r}
reactable(iris)
或者在**Shiny应用程序**中使用它:
```r
library(shiny)
library(reactable)

ui <- fluidPage(
  reactableOutput("table")
)

server <- function(input, output) {
  output$table <- renderReactable(reactable(iris))
}

shinyApp(ui, server)

学习资源

更多信息请查看以下示例:

浏览器支持

IE / Edge Firefox Chrome Safari Opera
IE 11**, Edge最新版 最近两个版本 最近两个版本 最近两个版本 最近两个版本

*IE 11的支持在reactable v0.4.0版本后已被弃用。

许可证

MIT

项目介绍

Interactive data tables for R

定制我的领域