闪亮数据表删除列标题和排序

4

我正在尝试使用一个闪亮的数据表格,但完全没有表头。我已经成功地不显示列名,但似乎无法去除带有排序箭头的表头:

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'))

有没有办法完全去掉标题栏?
2个回答

6

colnames = NULL现在不起作用了,它会返回“没有记录”的消息而不是数据表。但是空字符串可以使用。 我使用colnames = c("", "", "", "", "")来删除具有5列的表的列名。 在@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))

1
colnames = "" 对我来说已经足够了,甚至包括多列。 - Wilmar van Ommeren

5
我不了解整个标题栏,但这将删除排序标记。
   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))

同样的问题,@IndranilGayen 有什么想法吗? - pommedeterresautee
@pommedeterresautee 请尝试使用以下代码:datatable(df, rownames = NULL, colnames = NULL, options = list(dom = 'b', ordering = F)) - Indranil Gayen

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接