【发布时间】: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