简体   繁体   中英

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.

I'm trying to both use the packages title option but also RMarkdowns fig.cap .

Is there a way to enable both or do I have to work around it, for example with {{captioneer}} ?

edit: this question has been solved using 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()

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

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

例子

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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