用DT包输出的时候可以改一下R默认的table长度吗?
Can you change the R default table length when outputting with the DT package?
在 R DT 中,您可以 define the table control elements 使用如下代码:
# only display the table, and nothing else
library(DT)
datatable(mtcars, options = list(dom = 't'))
is a DOM. The DOM element l
controls the length changing input control上面的t
,基本上你的table就是多长。看起来像这样。
此 length changing input control 默认值为 10。如何将此默认值更改为 25、100,甚至“全部”?
您可以通过datatable(mtcars, options = list(dom = 't', pageLength = 3))
将其更改为3。
这会得到你想要的结果:
datatable(mtcars, options = list(dom = 't',
lengthMenu = list(c(25, 100, -1), c('25', '100', 'All')),
pageLength = 25
))
我们可以设置iDisplayLength:
datatable(mtcars, options = list(iDisplayLength = 25))
相关post:
在 R DT 中,您可以 define the table control elements 使用如下代码:
# only display the table, and nothing else
library(DT)
datatable(mtcars, options = list(dom = 't'))
is a DOM. The DOM element l
controls the length changing input control上面的t
,基本上你的table就是多长。看起来像这样。
此 length changing input control 默认值为 10。如何将此默认值更改为 25、100,甚至“全部”?
您可以通过datatable(mtcars, options = list(dom = 't', pageLength = 3))
将其更改为3。
这会得到你想要的结果:
datatable(mtcars, options = list(dom = 't',
lengthMenu = list(c(25, 100, -1), c('25', '100', 'All')),
pageLength = 25
))
我们可以设置iDisplayLength:
datatable(mtcars, options = list(iDisplayLength = 25))
相关post: