首页 > 解决方案 > 数据未在 R 闪亮中显示 DT 复杂标题

问题描述

我正在尝试复制https://stackoverflow.com/a/45934505/7565465提供的答案,以使用 R Shiny 中的 DT 在数据表中显示复杂的标题。当我复制示例时,表格格式正确,但我的数据没有显示。如果我删除“容器 = 草图”,则会显示数据。我对“容器”的调用做错了什么?谢谢你。

sketch = htmltools::withTags(table(
              class = 'display',
              thead(
                tr(
                  th(rowspan = 2, 'ID'),
                  th(colspan = 2, 'Web Site'),
                  th(colspan = 4, 'Number of Edges'),
                  th(rowspan = 8, 'Position')
                ),
                tr(
                  th('URL'), th("Root URL"), th('Name'),
                  th('In'), th('Out'), th('Total')
                )
              )
            ))

   #dat is saved as a tibble
output$nodeList <- renderDT(dat %>% select( 
      id, url, rooturl, name, in_degree, out_degree, total_degree, betweeness), container = sketch)

标签: rshinydatatablesdt

解决方案


推荐阅读