In RStudio, is it possible to have a code chunk that sends commands to the terminal (specifically Windows CMD prompt)? I know that I can use the command prompt via the "Terminal" tab in RStudio, but I would like to write these commands in a code chunk within a larger RMarkdown document. This way, when I click "Run All", the commands are sent automatically at the appropriate time.
Asked
Active
Viewed 241 times
0
-
1The `system()`, `shell()`, or `system2()` commands (depending on your scenario) will all execute system commands from within R. – danh Oct 18 '21 at 22:28
-
Does this answer your question? [Highlight Bash/shell code in Markdown files](https://stackoverflow.com/questions/20303826/highlight-bash-shell-code-in-markdown-files) – manro Oct 18 '21 at 22:47
-
Does this answer your question? https://stackoverflow.com/questions/36928322/how-to-capture-the-output-of-system – manro Oct 18 '21 at 22:55
-
1Does this answer your question? [How to capture the output of system()](https://stackoverflow.com/questions/36928322/how-to-capture-the-output-of-system) – tripleee Oct 19 '21 at 04:29
-
Thanks, @danh, I was able to make it work using `shell()` – CFD Oct 20 '21 at 12:04