简体   繁体   English

Rmarkdown 和 gt::caption 放在表格/输出的底部?

[英]Rmarkdown and gt::caption placed at bottom of table/output?

this recently came up with the gt:: package but I also remember this from kableExtra as well iirc.这最近提出了 gt::package 但我也记得 kableExtra 以及 iirc。

I'm trying to both use the packages title option but also RMarkdowns fig.cap .我正在尝试同时使用 packages title 选项和 RMarkdowns fig.cap

Is there a way to enable both or do I have to work around it, for example with {{captioneer}} ?有没有办法同时启用两者,或者我是否必须解决它,例如使用{{captioneer}}

edit: this question has been solved using gt::gt(caption = "xy")编辑:这个问题已经用gt::gt(caption = "xy")解决了

Next: is it possible to place this caption at the bottom of the table?下一步:是否可以将此标题放在表格的底部?

Thanks!谢谢!

---
title: "gt caption"
author: ""
date: "10 5 2022"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

# Header

```{r, fig.cap="I also want this fig.cap", echo = FALSE}
tab <- gt::gt(pressure, caption = "xy")

tab <- gt::tab_header(tab,
title = gt::md(
  "Title via tab_header"))
tab
```

You could replace the caption argument in gt() with gt::tab_footnote()您可以将 gt() 中的标题参数替换为 gt::tab_footnote()

tab <- gt::gt(pressure) 
tab <- gt::tab_footnote(tab, footnote = "xy")

tab <- gt::tab_header(tab,
title = gt::md(
  "Title via tab_header"))
tab

例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM