如何在数据表中显示唯一行

问题描述 投票:0回答:1

我正在创建一个闪亮的仪表板, 我面临数据表中显示重复数据的问题。 如何在结果中显示唯一值 数据框名称“合并”

这是仪表板上显示的数据表代码。

showRecordColumns <- c('Supplier','# Parts at Risk' , 'DAM Score', 'REL Score', 'AGI Score', 'RES Score')
  SDRMSketch = htmltools::withTags(table(
    class = 'table table-striped table-hover',
    thead(
      tr(
        th(colspan = 1, ' '),
        th(colspan = 2, 'Buyer: Suilian', class="sdrm-table-head-buyer"),
        th(colspan = 3, 'Risk Matrix', class="sdrm-table-head-risk-matrics")
      ),
      tr(
        lapply(showRecordColumns, th)
      )
    )
  ))
output$SDRM <- DT::renderDataTable(DT::datatable(merged[,showRecordColumns],
                                      container = SDRMSketch,
                                      rownames = FALSE,
                                      extensions = 'Buttons',
                                      callback=JS('$(".buttons-csv").addClass("btn btn-inline btn-dark-outline"); return table;'),
                                      options = list(
                                                      paging = TRUE,
                                                      searching = TRUE,
                                                      fixedColumns = TRUE,
                                                      autoWidth = TRUE,
                                                      ordering = TRUE,
                                                      dom='Bftrip',
                                                      buttons = list(
                                                        list(extend = "csv", 
                                                             text = "Download Current Page", 
                                                             filename = "SDRM_page",
                                                             class = "btn",
                                                             exportOptions = list(
                                                               modifier = list(page = "current")
                                                             )
                                                        ),
                                                        list(extend = "csv", text = "Download Full Results", filename = "SDRM_data",
                                                             exportOptions = list(
                                                               modifier = list(page = "all")
                                                             )
                                                        )
                                                      )
                                                      )  
                                              ) %>% formatRound(c(3:6), 2)
                                              %>% formatStyle(c(2), background = styleColorBar(range(0:100), 'lightblue'))
                                      )
    
}

不知道在哪里使用独特条件

enter image description here

r shiny dt
1个回答
0
投票

尝试过 数据表(唯一(合并[,showRecordColumns])

© www.soinside.com 2019 - 2024. All rights reserved.