How to delete the header row in the table? I'm using renderTable to output the table and setting the colnames to empty strings. colnames(df) <- c("", "")
colnames(df) <- c("","")
does not do what you want here. You want colnames = FALSE
in your renderTable()
call.
Here is a simple example. Note that the result is the same with or without the colnames<-
line. I can reproduce your image with 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)