rmarkdown 错误“尝试使用零长度变量名" [英] rmarkdown error "attempt to use zero-length variable name"

查看:39
本文介绍了rmarkdown 错误“尝试使用零长度变量名"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我生成一个新的 rmarkdown 文件(或打开现有的 rmarkdown 文件)并尝试运行 rmarkdown 块时,我收到此错误:错误:尝试使用零长度变量名".我有 Win10,昨天重新安装了 R 和 Rstudio.我错过了什么?这个错误从何而来?

```{r 汽车}总结(汽车)``

<块引用>

```{r 汽车}错误:尝试使用零长度变量名

解决方案

将此作为可见性的答案:如果您尝试通过选择 Rmd 中的所有内容并按 Enter 键来运行,就像使用普通 R 脚本一样.RStudio 尝试将所有这些都作为 R 代码运行,包括降价部分,从而导致您看到的错误.

您可以通过单击绿色播放按钮或在 Rmd 编​​辑器顶部的下拉列表中选择运行选项之一来运行单个块来避免这种情况.

When i generate a new rmarkdown file (or open existing rmarkdown-files) and try to run a rmarkdown chunk, i get this error: "Error: attempt to use zero-length variable name". I have Win10 and did a fresh install of R and Rstudio yesterday. What did i miss? Where does this error come from?

```{r cars}
summary(cars)
```

```{r cars} Error: attempt to use zero-length variable name

解决方案

Putting this as an answer for visibility: this happens if you try to run by selecting all in the Rmd and pressing enter like you would with a normal R script. RStudio tries to run this all as R code, including the markdown parts, leading to the errors you saw.

You can avoid this by running an individual chunk by clicking the green play button or by selecting one of the run options in the dropdown at the top of the Rmd editor.

这篇关于rmarkdown 错误“尝试使用零长度变量名"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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