RMarkdown error in YAML

为君一笑 提交于 2019-12-04 15:44:41

问题


I watched a great webinar by RStudio the other day about RMarkdown. After the webinar they posted the code used in the demonstrations online and I wanted to check out one example. I took their code, put it in my RStudio (which says it's fully up-to-date, v0.98.978), installed or updated all the necessary packages and hit "Run Document"

I receive an error which I do not understand and for which Google has been very unhelpful. What is this mysterious <document start> and how do I include it? I assumed all necessary components would be included given the source of the code.

Error in yaml::yaml.load(front_matter) : 
  Parser error: did not find expected <document start> at line 2, column 1
Calls: <Anonymous> -> parse_yaml_front_matter -> <Anonymous> -> .Call
Execution halted

回答1:


The issue came from copying the code from the browser to Rstudio.

The original header information was:

---
title: "Linked brushing"
output: html_document
runtime: shiny
---

the pasted text was:

---
  title: "Linked brushing"
output: html_document
runtime: shiny
---

The missing <document start> was an unequal amount of white space before each element of the header. This can be fixed by adding white space to the 'output' and 'runtime' lines or by removing the white space of the 'title' line.



来源:https://stackoverflow.com/questions/25382459/rmarkdown-error-in-yaml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!