在 flextable 的单元格内引用

Citing inside the cell of flextable

我正在尝试使用 rmarkdown 和 flextable 创建一个 table,我在其中引用了各种作品。

我的 Rmakrdown 文件:

---
title: "Innovative title"
author: "Vag Vaf"
date: '2021-12-29'
bibliography: references.bib
csl: apa-6th-edition.csl
output:
  bookdown::word_document2:
    fig_caption: yes
  pdf_document:
    toc: true
    toc_depth: 2
    citation_package: natbib
    keep_tex: true
    extra_dependencies: rotating, bookmark
  fontsize: 12pt
  geometry: margin=1in
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
knitr::opts_chunk$set(fig.retina = 3, warning = FALSE, message = FALSE)
```

```{r studies-table}
studies.table <- tibble (
  Authors = c("@Author1",
              "@Author2"),
  Area = c("Area1",
           "Area2")
    )
ft <- flextable(studies.table)
```

在我的 references.bib:

@article{Author1,
author = {Author, Solo},
journal = {Journal of Reproducible Examples},
pages = {1--18},
title = {{Yet another Test Title}},
volume = {1},
year = {2022}
}
@article{Author2,
author = {Author, Two and Author, Four},
journal = {Journal of Reproducible Examples},
pages = {75--82},
title = {{Awesome title}},
volume = {1},
year = {2022}
}

我正在尝试使用此代码,但@Author1 和@Author2 未转换为实际引用。它们在 table 中显示为 @Aurthor1@Author2。有什么方法可以表明应该将其转换为引文吗?

ftExtra 是 markdown 语法在灵活单元格中工作所必需的:

```{r setup, include=FALSE}
library(easypackages)
packages(
  "tidyverse",
  "flextable",
  "ftExtra"
)
knitr::opts_chunk$set(echo = FALSE)
knitr::opts_chunk$set(fig.retina = 3, warning = FALSE, message = FALSE)
```

```{r studies-table}
studies.table <- tibble(
  Authors = c(
    "@Author1",
    "@Author2"
  ),
  Area = c(
    "Area1",
    "Area2"
  )
)
flextable(studies.table) %>%
  ftExtra::colformat_md()
```