YAML文件中关于扫描简单键的错误

huangapple go评论108阅读模式
英文:

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解析器似乎不太好。我建议将titleauthor的值明确指定,因为解析器似乎不能正确识别其中一个的值指示符(可能是因为值指示符后面没有空格):

---
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    
---

huangapple
  • 本文由 发表于 2023年7月3日 17:33:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/76603501.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定