【问题标题】:How to create datatable with complex header in R Shiny?如何在 R Shiny 中创建具有复杂标题的数据表?
【发布时间】:2014-05-18 20:04:13
【问题描述】:

我在R Shiny 中有一个datatable,并希望有span multiple columns like below 的标题:

如何在 R Shiny 中实现这一点?

【问题讨论】:

    标签: r datatables jquery-datatables shiny


    【解决方案1】:

    已经有例子http://rstudio.github.io/DT/

    library(DT)
    sketch = htmltools::withTags(table(
      class = 'display',
      thead(
        tr(
          th(rowspan = 2, 'Species'),
          th(colspan = 2, 'Sepal'),
          th(colspan = 2, 'Petal')
        ),
        tr(
          lapply(rep(c('Length', 'Width'), 2), th)
        )
      )
    ))
    datatable(iris[1:20, c(5, 1:4)], container = sketch, rownames = FALSE)
    

    【讨论】:

    【解决方案2】:

    看看来自 RStudio DT (https://github.com/rstudio/DT) 的新包?在这里http://rstudio.github.io/DT/,您可以找到您需要的示例。

    【讨论】:

      猜你喜欢
      • 2018-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-28
      • 1970-01-01
      • 1970-01-01
      • 2014-04-14
      • 2021-12-31
      相关资源
      最近更新 更多