英文:
Error in YAML file regarding scanning a simple key
问题
我有一个R markdown文件,其中一个输入是.csv文件,要生成为pdf文件。
---
title:
author:
output:
pdf_document:
latex_engine: pdflatex
html_document:
df_print: paged
params:
csv_input: NULL
---
在运行文件时,我收到以下错误:
警告:错误 in yaml::yaml.load: 扫描器错误:在第3行,第1列扫描简单键时,在第4行,第1列找不到预期的 ':'。
有没有解决这个错误的办法?YAML似乎是有效的。
我检查了YAML,它是有效的。我还完全删除了YAML,但仍然出现类似的错误。
英文:
I have an R markdown file with an input as .csv to be generated into a pdf file.
---
title:
author:
output:
pdf_document:
latex_engine: pdflatex
html_document:
df_print: paged
params:
csv_input: NULL
---
While running the file, I get the following error:
> Warning: Error in yaml::yaml.load: Scanner error: while scanning a
> simple key at line 3, column 1 could not find expected ':' at line 4,
> column 1
Is there any way around this error? The YAML seems to be valid.
I checked the YAML which is valid. Entirely removed the YAML as well, which gives a similar error.
答案1
得分: 1
R标记中使用的YAML解析器似乎不太好。我建议将title
和author
的值明确指定,因为解析器似乎不能正确识别其中一个的值指示符(可能是因为值指示符后面没有空格):
---
title: NULL
author: NULL
output:
pdf_document:
latex_engine: pdflatex
html_document:
df_print: paged
params:
csv_input: NULL
---
英文:
The YAML parser used within R markdown doesn't seem to be a good one. I recommend making the values for title
and author
explicit as parser doesn't seem to recognise the value indicator for one of them correctly (probably because the value indicator is not followed by a space):
---
title: NULL
author: NULL
output:
pdf_document:
latex_engine: pdflatex
html_document:
df_print: paged
params:
csv_input: NULL
---
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论