【问题标题】:How to delete header row in R shiny dataframe being output using renderTable?如何删除使用renderTable输出的R闪亮数据框中的标题行?
【发布时间】:2021-03-15 04:36:12
【问题描述】:

如何删除表格中的标题行?我正在使用 renderTable 输出表格并将 colnames 设置为空字符串。 colnames(df)

【问题讨论】:

    标签: javascript r shiny shinydashboard shinyjs


    【解决方案1】:

    colnames(df) <- c("","") 不会在这里做你想做的事。您希望在您的renderTable() 通话中使用colnames = FALSE

    这是一个简单的例子。请注意,无论是否使用colnames<- 行,结果都是相同的。我可以用colnames = TRUE复制你的图片

    library(shiny)
    ui <- fluidPage(
        flowLayout(
            mainPanel(
               tableOutput("testTable")
            )
        )
    )
    server <- function(input, output) {
        dat <- data.frame(a = c(1,2,3),b = c(4,5,6),c = c(7,8,9))
        colnames(dat) <- c("","","")
        output$testTable <- renderTable(dat, colnames = FALSE, bordered = TRUE)
    }
    shinyApp(ui = ui, server = server)
    

    【讨论】:

      猜你喜欢
      • 2020-03-03
      • 2016-01-28
      • 2014-02-28
      • 2014-06-30
      • 2018-11-08
      • 2021-02-13
      • 2020-03-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多