I would like to test code parts in my R Markdown code without leaving Sublime Text.
For instance:
Multiplying the grades with two solves the unreliability problem:
```{r}
chisq.test(2*grades)
```
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.
However, when I try this, I get the following error from SublimeREPL:
Cannot find REPL for 'HTML.markdown.rmarkdown'
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.
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.
You can insert an R code chunk either using the RStudio toolbar (the Insert button) or the keyboard shortcut Ctrl + Alt + I ( Cmd + Option + I on macOS).
R Markdown still runs the code in the chunk, and the results can be used by other chunks. echo = FALSE prevents code, but not the results from appearing in the finished file. This is a useful way to embed figures. message = FALSE prevents messages that are generated by code from appearing in the finished file.
To open a new file, click File > New File > R Markdown in the RStudio menu bar. A window will pop up that helps you build the YAML frontmatter for the . Rmd file. Use the radio buttons to select the specific type of output that you wish to build.
The first thing you'll do after opening RStudio is go to File » New File » R Markdown. Then a new window will pop up where you can fill out the title of your new document, the author (um, your name? 😉), and the output format. You can choose between HTML, PDF, and Word.
From this answer :
Open the file SublimeREPL/config/R/Main.sublime-menu
. Its default position depends on your system
~/.config/sublime-text-3/Packages
~/Library/Application Support/Sublime Text 3/Packages
(untested)%APPDATA%/Sublime Text 3/Packages
(untested)Add your scode to the option "additional_scopes":
"additional_scopes": ["HTML.markdown.rmarkdown","tex.latex.knitr"],
Save the file, close the REPL tab, restart sublime, and open a new REPL instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With