Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RMarkdown error in YAML

Tags:

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 
like image 996
Mark Avatar asked Aug 19 '14 11:08

Mark


1 Answers

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.

like image 130
Mark Avatar answered Sep 21 '22 16:09

Mark