I've been learning R Markdown for the past months. It was fairly easy to get Anaconda Python to run within a R Markdown script, but I haven't yet found a way to get to run chunks of bash code within the same document.
Using
```{bash}
echo hello world
```
I get the error message
/bin/bash: C:\Users\MyName\AppData\Local\Temp\Rtmp0MpNfS\chunk-code-4cbc213a3545.txt: No such file or directory
Might any of you guys know what might be the root of this problem?
BASH will be available in the Command Prompt and PowerShell. Open Command Prompt and navigate to the folder where the script file is available. Type Bash script-filename.sh and hit the enter key. It will execute the script, and depending on the file, you should see an output.
Use Rscript to run R from bash You can run it using Rscript test. r . And even better, if you add an initial shebang line #!/usr/bin/env Rscript in the script above and make it executable with chmod +x test. r , you can directly launch your R script with ./test.
Press Windows key + X then click Command prompt, at the command prompt, type: bash then hit Enter. If you want to be able to access the local file system, press Windows key + X, Command Prompt (Admin) then type bash at the prompt.
R Markdown is an extension of the markdown syntax. R Markdown files are plain text files that typically have the file extension . Rmd . They are written using an extension of markdown syntax that enables R code to be embedded in them in a way which can later be executed.
I know maybe is to late but I had the same problem and I find the solution.
First, in Windows 8.1 or if you don´t have the Windows Subsystem for Linux (WSL) you can install Cygwin: https://cygwin.com/ > Install Cygwin
Second, add Cygwin to the PATH. Usually Cygwin is installed in C:\cygwin64
and the path to include will be in this case C:\cygwin64\bin
Third, check that everything is correct using base::Sys.which("bash")
in R
"C:\\cygwin64\\bin\\bash.exe"
Fourth, you can run in a Rmarkdown document, the chunk that you pointed out to double check:
```{bash}
echo hello world
```
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