It is fairly straightforward to implement something like this with
system2. You could go as far as you want here, really, if you want to make the command-line experience better... I just wanted a simple terminal for exploration:
I'll work on exposing the code on GitHub. The only real way to see what I did at present is by executing
cat app.R. I'm basically just splitting the command into
args and passing it to
system2 when the user clicks
Worth noting that this is a bad idea from a security perspective because it allows your users to execute arbitrary code on your operating system without any sanity checking from you. (I.e. they could spawn a run-away forking process and fill up your server). Perhaps useful from an educational perspective, though I leave the security and implementation to you!
EDIT: Also note - I installed the
odbc package for no real reason relative to your question
learnr would be the better example to walk users through a training session where they had a terminal / access to running R code.