I have noticed this issue when knitting all file types (html, pdf, word). To make sure there's not an issue specific to my program, I went ahead and ran the default .rmd file you get when you create a new markdown. In each case, it does knit correctly, but I always see this at the end. I have searched online and here but cannot seem to find an explanation
Error in yaml::yaml.load(string, ...) :
Scanner error: mapping values are not allowed in this context at line 6, column 19
Error in yaml::yaml.load(string, ...) :
Scanner error: mapping values are not allowed in this context at line 6, column 19
Error in yaml::yaml.load(string, ...) :
Scanner error: mapping values are not allowed in this context at line 4, column 22
Here is my default YAML
---
title: "Untitled"
author: "Scott Jackson"
date: "April 20, 2017"
output: word_document
---
Line 4, column 22 is the space between the 7 and " I'm not sure where Line 6, column 19 is, but that line is the dashes at the bottom
Any ideas?
Thank you.
I realize this question has gone unanswered for awhile, but maybe someone can still benefit. I had the same error message and I realized I had an extra header command in my yaml. I can't reproduce your exact error, but I get the same message with different line/column references with:
---
title: "Untitled"
author: "Scott Jackson"
date: "April 20, 2017"
output: output: word_document
---
Error in yaml::yaml.load(string, ...) :
Scanner error: mapping values are not allowed in this context at line 4, column 15
Calls: <Anonymous> ... parse_yaml_front_matter -> yaml_load_utf8 -> <Anonymous>
Execution halted
Line 4 column 15 seems to refer to the second colon after the second "output".
I get this error when trying to add a table of contents to the YAML:
title: "STAC2020 Data Analysis"
date: "July 16, 2020"
output: html_notebook:
toc: true
However, if I put html_notebook:
on to a separate line then I don't get the error:
title: "STAC2020 Data Analysis"
date: "July 16, 2020"
output:
html_notebook:
toc: true
I do not know why this formatting makes a difference, but it allowed my document to knit and with a table of contents.
I received this error when there was an indentation in the wrong place:
For example, the indentation before header-includes
as seen in the example code below caused the error
---
title: "This is a title"
author: "Author Name"
header-includes:
.
.
.
---
When you remove the indentation, the following code below did not produce the error:
---
title: "This is a title"
author: "Author Name"
header-includes:
.
.
.
---
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With