提问人:MikeS 提问时间:11/1/2023 最后编辑:shafeeMikeS 更新时间:11/8/2023 访问量:43
?(标题) 在尝试将 GT 表放入具有 HTML 输出的 Quarto 选项卡集时添加
?(caption) added when trying to put gt tables into a quarto tabset with html output
问:
我正在使用带有 HTML 输出的 Quarto。我想创建一个选项卡集,其中每个选项卡包含多个表。渲染时,我得到 ?(标题)在我的表格底部。当我不创建选项卡集时,不会发生这种情况。
我尝试了标签/字幕/等的各种排列......但似乎无法得到?(标题)走开。
下面的可重现示例,然后是输出。
---
title: "Test"
format: html
---
## Multiple Tables
```{r}
library(tidyverse)
library(gt)
t1 <-
gtcars |>
dplyr::select(mfr, msrp) |>
dplyr::slice(1:5) |>
gt() |>
tab_header(
title = md("Data listing from **gtcars**"),
subtitle = md("`gtcars` is an R dataset")
) |>
tab_caption(caption ="tbl-t1")
t2 <-
gtcars |>
dplyr::select(model, msrp) |>
dplyr::slice(1:5) |>
gt() |>
tab_header(
title = md("Data listing from **gtcars**"),
subtitle = md("`gtcars` is an R dataset")
) |>
tab_caption(caption = "tbl-t2")
```
```{r}
#| tbl-cap: "Two Tables"
#| tbl-cap-location: bottom
#| tbl-subcap:
#| - "mfr"
#| - "model"
#| layout-ncol: 2
#| layout-nrow: 1
#| layout-valign: top
#| echo: false
t1
t2
```
:::{.panel-tabset}
#### Tab
```{r}
#| tbl-cap: "Two Tables"
#| tbl-cap-location: bottom
#| tbl-subcap:
#| - "mfr"
#| - "model"
#| layout-ncol: 2
#| layout-nrow: 1
#| layout-valign: top
#| echo: false
t1
t2
```
:::
答: 暂无答案
评论