last day (15 days later) » 

1:30 AM
0
Q: R Studio - Cannot use BASH in R Markdown

CyberGeneticistI am learning R and R Markdown, working in R Studio. I am running Windows 10 (64-bit), with Windows Subsystem For Linux activated. I checked that it works - I have installed Ubuntu and used BASH etc. and it works fine. However, when I try to use BASH (or SH for that matter) inside R Markdown by w...

 
You didn't say whether you're running R in Windows or WSL. Kinda important
 
Sorry, didn't realise running in the WSL is an option. I am running R Studio in Windows.
 
Does running "bash" work at the command prompt?
 
Just checked, yes it does!
 
try manually calling rmarkdown::render on your document
 
1:30 AM
Thanks. I did this, but I am not sure what I should look out for, got a bunch of code as output in the console, no errors that I can see.
 
Look at the rendered file
 
It did not open a rendered (HTML) file if that is what you mean. If I have to manually open it somehow to look at it after running the above code, please let me know. Thanks
 
I mean look at the rendered file
 
I am lost on how to do that. Normally, when a document 'knits' successfully, it automatically opens afterwards. After running the command you suggested, nothing opened.
 
I just tried this on ubuntu 20.04 LTS and works fine for me. I get an .html with the rendered pwd output. Did you include a minimal YAML --- title: "Untitled" output: html_document ---?
 
1:30 AM
@jay.sf even that yaml is unnecessary, the default is to create a html file in the same directory as the source file
 
@HongOoi You're right! Throws a [WARNING] This document format requires a nonempty <title> element. Defaulting to 'foo.knit' as the title. To specify a title, use 'title' in metadata or --metadata title="...". though.
 
Your yaml would also not help OP, since they apparently can't find their file, lol
 
jay.sf - Yes, the minimal YAML , including 'output: html_document' was included by R Studio by default. Hong Ooi - as for finding the file, I did check the folder it should output to, but no luck, no HTML file there.
 
@CyberGeneticist It actually should be in path outputted withgetwd() which usually initially should correspond with pwd .
 
jay.sf - Yes, thank you, and that is where I checked. Nothing.
 
1:30 AM
@CyberGeneticist Well, try ~$ find . -name foo.html
 
There is no file, searched my entire PC. I don't think it made an HTML.
 
@CyberGeneticist Ok, the difference is, I run purely ubuntu, I therefore suppose it's a windows/WSL issue. Consider to switch completely to linux! ;) Good luck!
 
@jay.sf rendering an rmd file containing a bash block works perfectly well on my Win10 machine. OP just doesn't know how to drive it
@CyberGeneticist try again
 
I understand it works normally. I don't know why it doesn't work on my PC. When I try it on my laptop, with a comparable setup (Win 10 64-bit, comparable R Studio version, and WSL + ubuntu) it works. Almost identical setup, two completely different sets of results.
 
@CyberGeneticist You probably should ask some linux experts on unix.stackexchange who are able to "scan" your system settings a little better.
 

last day (15 days later) »