我想知道是否有一个技巧,将当前日期放在knitr
和rmarkdown
包处理的.rmd
个文档的YAML前端.我以前在我的维基页面顶部有下面一行,
_baptiste, `r format(Sys.time(), "%d %B, %Y")`_
它会在html输出中转换为baptiste, 03 May, 2014.现在,我想利用rmarkdown
提供的高级pandoc包装器,但在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
有解决办法吗?