在我YAML呼叫我有yaml中的Windows变量(“%userprofile%”)?
---
title: "`r paste0('Test. Done ', format(Sys.Date(), '%B-%Y'))`"
output:
word_document:
fig_caption: yes
fig_height: 4
fig_width: 7
reference_docx: %userprofile%\Documents\template.docx
---
但YAML抱怨%userprofile%
。是否有可能包含这样一个变量?
我试过了,例如
reference_docx: "`r file.path(path.expand('~'), 'skabelon.docx')`"
但是,这仍然导致此YAML错误。
pandoc.exe: `r file.path(path.expand('~'), 'skabelon.docx')`: openBinaryFile: does not exist (No such file or directory)
我猜这个表达式在yaml之前没有被处理过吗?我检查过该文件是否存在...或者是否因为pandoc正在使用另一个'userprofile'?我该如何检查?
但是,根据上面更新的标题,我可以在Title
变量中使用这样的调用。我想这一定是一个特定的针织问题。
您应该为第二个输入提供YAML错误。 – flyx
我已更新问题@flyx – Andreas