Table 1:...在使用xtable()或knitr::kable()在.Rmd文件中时,我想从R脚本中命名我的表而没有自动前缀.输出是pdf文档.
这是.Rmd文件中可重现的示例:
---
title: "Suppress automatic table name and number"
output: pdf_document
---
```{r myirischunk, results = 'asis', tab.cap = NULL, echo = TRUE}
library(xtable)
print(knitr::kable(head(iris), caption = "I sure wish it would say Table 1.a"))
print(knitr::kable(head(iris), caption = "Please stop"))
print(xtable(head(iris), caption = "Same thing with xtable"))
```
Run Code Online (Sandbox Code Playgroud)
我已经看到了一些建议,类似的问题在这里,但我似乎无法得到它在.Rmd文件工作.
Table: Table one在R Markdown pdf文档中获取表格标题的默认功能(示例)很不错.但我很难从默认的英语"表格"改为其他东西,同时保持位置(上表)和编号.编号是可以解决的,我可以编写自己的计数函数,但放置必须在表格之上.
我试图用来Pander设置一个新的前缀,但这似乎打破了位置和编号.
有没有人知道我应该做什么,我可以更改默认表格标题,同时(至少)保持默认位置在表格之上但最好还保持编号吗?