如何在SublimeREPL的R Markdown文件中运行R代码? [英] How to run R Code in R Markdown file in SublimeREPL?
问题描述
我想在我的R Markdown代码中测试代码部分,而无需离开Sublime Text.
I would like to test code parts in my R Markdown code without leaving Sublime Text.
例如:
Multiplying the grades with two solves the unreliability problem:
```{r}
chisq.test(2*grades)
```
在上面的示例中,我想选择代码为"chisq.test(2 * grades)"的行,按我的组合键,然后将其作为R代码在SublimeREPL中运行.
In the above example, I would like to select the line that has the code "chisq.test(2*grades)", press my key combination, and have it ran in SublimeREPL as R code.
但是,当我尝试这样做时,我从SublimeREPL收到以下错误:
However, when I try this, I get the following error from SublimeREPL:
找不到"HTML.markdown.rmarkdown"的REPL
Cannot find REPL for 'HTML.markdown.rmarkdown'
当我通过视图菜单将语法更改为"R"(而不是R Markdown)时,代码运行良好.不过,这是一种解决方法,因此不受欢迎,因为这会花费我R Markdown语法高亮显示.
When I change the syntax through view menu to "R" (rather than R Markdown), the code runs fine. This is a workaround though, and it is undesirable because it costs me R Markdown syntax highlighting.
我怀疑该解决方案只是复制粘贴了几行SublimeREPL软件包代码,然后将它们重新用于R Markdown,但我仍然无法实现任何结果.我将不胜感激.
I suspect the solution is simply copy-pasting a few lines of SublimeREPL package code and repurposing them for R Markdown, but I was unable to achieve any results yet. I'd appreciate any help.