如何避免 table (datatable) 在 flexdashboard 容器中被其他文本截断?

How can I avoid a table (datatable) being truncated in a flexdashboard container by an additional text?

当数据table 对象上方有文本时,table 被截断并且分页不再可见。

是否可以调整数据大小table使其适合一个 flexdashboard 容器?

---
title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
library(DT)
```

Column {data-width=650}
-----------------------------------------------------------------------

### Chart A

```{r, results='asis'}
cat("This is a text\n\nThis is a text")
```

```{r}
mtcars %>% datatable(options = list(dom = 'tp'))
```

你有几个选择。您可以使用 vertical_layout: scroll。这将允许分页工作,同时将文本保持在与 table.

相同的容器中
---
title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: scroll
---

```{r setup, include=FALSE}
library(flexdashboard)
library(DT)
```

Column {data-width=650}
-----------------------------------------------------------------------

### Chart A

```{r, results='asis'}
cat("This is a text\n\nThis is a text")
```

```{r}
mtcars %>% datatable(options = list(dom = 'tp'))
```

或者,您可以为文本和 table 使用单独的容器。如果这样做,您可能希望使用 {data-height} 设置容器的高度。

---
title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
library(DT)
```

Column {data-width=650}
-----------------------------------------------------------------------

### Text A {data-height=50}

```{r, results='asis'}
cat("This is a text\n\nThis is a text")
```

### Chart A

```{r}
mtcars %>% datatable(options = list(dom = 'tp'))
```