YAML 中的 RMarkdown 错误 [英] RMarkdown error in YAML

查看:64
本文介绍了YAML 中的 RMarkdown 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前几天我观看了 RStudio 举办的关于 RMarkdown 的精彩网络研讨会.网络研讨会结束后,他们在线发布了演示中使用的代码,我想查看一个示例.我拿了他们的代码,把它放在我的 RStudio(说它是完全最新的,v0.98.978),安装或更新了所有必要的包,然后点击运行文档"

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"

我收到一个我不明白的错误,Google 对此非常无助.这个神秘的<文档开始>是什么?以及如何包含它?我假设所有必要的组件都包含在代码源中.

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

推荐答案

问题来自将代码从浏览器复制到 Rstudio.

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

原始头信息为:

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

粘贴的文字是:

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

这篇关于YAML 中的 RMarkdown 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆