无法使用Rstudio中使用Knit Word从Rstudio修改的Word模板。本周安装并更新了Rstudio和所需的软件包。运行OS X 10.10.5并使用Word 2011.简易测试谢益辉的113-externalization.rmd和113-foo.R,并在此主题上跟随他的Vimeo视频https://vimeo.com/110804387。在所有情况下,编织RMD文件都使用默认格式,而不是以template.docx格式存储的修改模板。我曾尝试将副本放在项目目录中的所有位置,但都没有成功。无法在RStudio knitr中使用修改过的单词模板
#113-externalization.Rmd
---
title: "Untitled"
output:
word_document:
reference_doc: "template.docx"
---
# Code Externalization
```{r cache=FALSE}
knitr::read_chunk('113-foo.R')
```
The following two chunks are from the external R script `113-foo.R`:
```{r test-a}
```
```{r test-b}
```
#code for 113-foo.R
# ---- test-a ----
1 + 1
x = rnorm(10)
# ---- test-b ----
mean(x)
sd(x)
搜索发现Changing word template for knitr in Rmarkdown,但未能在项目目录中的任何位置找到修改的模板。
在视频中他使用'reference_docx:'。这是否有所作为? –
是的,我改为reference_docx:并收到一条失败消息。输入文本为 – user3838963
对我来说,它可以使用'reference_docx:word-template.docx'工作。确保YAML标题中的缩进是正确的(再次检查视频)。 –