在 kable / kableExtra 中包含脚注和 repeat_header

Include footnote and repeat_header in kable / kableExtra

当我包含来自 kableExtra 的 repeat_header 选项 (kable_styling) 时,我丢失了脚注。我在帮助文件中看到 kable_styling "can get a bit tricky." 这是我遇到的问题还是我遗漏了什么?在下面的代码中,我没有得到脚注。如果我删除 kable_styling,我会得到 foonote。在我的真实情况下,我有一个很长的 table,但据我所知,kable_styling 是罪魁祸首。

我今天 (9/18/17) 刚刚用 github 版本更新了 kableExtra

谢谢!

---
title: "Untitled"
output: 
pdf_document: 
latex_engine: xelatex
---

```{r setup, include=FALSE}
library(knitr)
library(kableExtra)
```

```{r cars,results='asis'}
kable(mtcars,format='latex',booktabs=TRUE,col.names=c("mpg","cyl[note]","disp","hp","drat","wt","qsec","vs","am","gear","carb"),
longtable=T,caption="This is my table caption") %>% 
 add_footnote(c("This is my footnote")) %>% 
 kable_styling(latex_options = c("repeat_header"))
```

Now it’s recommended to use the new footnote function instead of add_footnote to make table footnotes (see Manual kableExtra, p.18)

新的脚注功能有更多可能:

There are four notation systems in footnote, namely general, number, alphabet and symbol. The last three types of footnotes will be labeled with corresponding marks while general won’t be labeled.

而不是 add_footnote(c("This is my footnote")) 你现在可以这样写

footnote(general = "This is my footnote")