gpt4 book ai didi

r - DT 在 DT 中显示更多行

转载 作者:行者123 更新时间:2023-12-03 21:27:15 25 4
gpt4 key购买 nike

当我运行以下代码时,我只得到 1 或 2 行数据。如何增加显示的行数?谢谢!

    ---
title: " File Analysis"
output:
html_document: default
pdf_document: default
word_document: default
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE,comment = NA, echo=FALSE,message= FALSE, warning = FALSE)
```
**As can be seen in Table 1 below**
```{r echo=FALSE, message=FALSE,warning = FALSE}
cwater<-matrix(rbinom(10*100, 1, .5), ncol=10)

library("knitr","xtable", quietly = TRUE)
library(DT, quietly = TRUE)
datatable(cwater, caption = 'Table 1: This is a searchable table of the water content.',
class = 'cell-border stripe', filter = 'top',extensions = 'Buttons',fillContainer=TRUE, options = list(
pageLength = 10, autoWidth = TRUE,dom = 'Bfrtip',buttons = c ('copy', 'print'), scrollX = TRUE,
selection="multiple"
))
```

最佳答案

您需要增加容器的大小或关闭 'fillContainer' 选项:

---
title: "DT Table Example"
output:
html_notebook:
toc: true
number_sections: false
theme: united
highlight: tango
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE,comment = NA, echo=FALSE,message= FALSE, warning = FALSE)
```
**Turn off the 'fillContainer' option**
```{r echo=FALSE, message=FALSE,warning = FALSE}
cwater<-matrix(rbinom(10*100, 1, .5), ncol=10)

library("knitr","xtable", quietly = TRUE)
library(DT, quietly = TRUE)
datatable(cwater,
caption = 'Table 1: This is a searchable table of the water content.',
class = 'cell-border stripe',
filter = 'top',
extensions = 'Buttons',
fillContainer = FALSE,
options = list(pageLength = 10,
autoWidth = TRUE,
dom = 'Bfrtip',
buttons = c('copy',
'print'),
scrollX = TRUE,
selection="multiple"
))
```

关于r - DT 在 DT 中显示更多行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44368572/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com