首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >以rmarkdown表示的YAML当前日期

以rmarkdown表示的YAML当前日期
EN

Stack Overflow用户
提问于 2014-05-04 04:13:30
回答 5查看 102.5K关注 0票数 292

我想知道是否有什么技巧可以将当前日期放在要由knitrrmarkdown包处理的.rmd文档的YAML前缀中。我曾经在我的wiki页面的顶部有下面这行,

   _baptiste, `r format(Sys.time(), "%d %B, %Y")`_

它将在html输出中转换为baptiste,2014年5月3日。现在,我想利用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

有什么解决方法吗?

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23449319

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档