4
votes

I am trying to use a shiny data table without the header at all. I got to the point of not displaying column names, but can't seem to get rid of the header with sorting arrows:

library(DT)
df < data.frame(x = c('a', 'b', 'c'), y = c(1, 2, 3))
datatable(df, rownames = NULL, colnames = NULL, options = list(dom = 't'))

Is there any way to just get rid of the header totally?

2

2 Answers

5
votes

I don't know about the whole header, but this removes the sort ticks.

   library(DT)
    df <- data.frame(z = c('a', 'b', 'c'), y = c(1, 2, 3))
    datatable(df, rownames = NULL, colnames = NULL, options = list(dom = 't',bSort=FALSE))
4
votes

colnames = NULL is not working now, it gives "no record found" message instead of data table. But empty strings works. I used colnames = c("", "", "", "", "") for table with 5 columns to remove column names. With help @Wilmar van Ommeren

library(DT)
df <- data.frame(x = c('a', 'b', 'c'), y = c(1, 2, 3))
datatable(df, rownames = NULL, colnames = '', options = list(dom = 't', bSort=FALSE))