如何将DT包中的列居中? R

问题描述 投票:0回答:1
datatable(head(iris))

enter image description here

我如何使我的列居中,使它们位于我的列名的下面?

r dt
1个回答
0
投票

targets设置要作为中心的列,例如全部使用0:4(从零开始)或_all

library(DT)
datatable(head(iris),
          options = list(columnDefs = 
                           list(list(className = 'dt-center', 
                                     targets = "_all"))))

enter image description here

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