【问题标题】:Handling output options in metadata处理元数据中的输出选项
【发布时间】:2014-08-24 00:11:43
【问题描述】:

我在 RStudio 中创建了一个新的 RMarkdown 文件(使用最新版本的 R 和 RStudio)。标题默认为:

---
title: "Untitled"
author: "David Arnold"
date: "August 23, 2014"
output: html_document
---

那我去:http://rmarkdown.rstudio.com/?version=0.98.1028&mode=desktop

我认为:

---
title: "Sample Document"
output:
  html_document:
    toc: true
    theme: united
---

所以我尝试添加到我的标题中:

---
title: "Untitled"
author: "David Arnold"
date: "August 23, 2014"
output: html_document:
toc: true
---

但是现在当我使用 knitHTML 进行编译时,我得到以下响应:

Error in yaml::yaml.load(front_matter) : 
  Scanner error: mapping values are not allowed in this context at line 4, column 22
Calls: <Anonymous> -> parse_yaml_front_matter -> <Anonymous> -> .Call
Execution halted

我做错了什么?

【问题讨论】:

  • 我认为缩进很重要
  • 删除 html_document 末尾的冒号将删除错误。但是要获得 TOC,您需要像第二个标题中那样缩进。

标签: r knitr rstudio r-markdown


【解决方案1】:

我认为您需要在 html_document: 之后删除冒号(即 :):

【讨论】:

  • 工作。我还在 RStudio 中发现了这个图标,它允许用户无需输入就可以做出选择。正确的缩进和编码是使用这个图标的结果。
猜你喜欢
  • 1970-01-01
  • 2011-02-23
  • 1970-01-01
  • 1970-01-01
  • 2011-02-05
  • 2022-07-09
  • 1970-01-01
  • 1970-01-01
  • 2021-04-25
相关资源
最近更新 更多