我想知道是否有技巧将当前日期放在.rmd要处理的文档的YAML前端,knitr并且rmarkdown程序包。我以前在Wiki页面的顶部有以下行,
_baptiste, `r format(Sys.time(), "%d %B, %Y")`_
它将在html输出中转换为baptiste,2014年5月3日。现在,我想利用所提供的高级pandoc包装器rmarkdown,但是在YAML标头中包含r代码似乎不起作用:
---
title: "Sample Document"
output:
html_document:
toc: true
theme: united
date: `r format(Sys.time(), "%d %B, %Y")`
author: baptiste
---
Error in yaml::yaml.load(front_matter) :
Scanner error: while scanning for the next token at line 6, column 7
found character that cannot start any token at line 6, column 7
Calls: <Anonymous> ... output_format_from_yaml_front_matter ->
parse_yaml_front_matter -> <Anonymous> -> .Call
任何解决方法?

!expr,例如date: !expr Sys.time(),但现在也不起作用。