Alternative R consoles

Awesome. For some reason I've never enabled that option before. Thanks!

@jonathan, is there a method to send a command to the terminal in an R script (rather than invoking it with a keystroke)? I'm trying to do this in Windows via system() or shell() but I'm getting errors. My command runs fine in the terminal, though!

You can use these command to make system call from an R script. This should work. What is the command you use and what is the error you get?

For your interest, there is also the package sys which helps with system command from R. It is a replacement for base R functions.

There sure is. You want to use the rstudioapi package. It has a terminalSend(...) method to send commands to the built-in terminal.

1 Like

@jonathan Thanks, rstudioapi::terminalSend() worked for me with a little tweaking!

@cderv I would like to open a tunnel using ssh so I can connect to a remote db. Basically a ssh <params> call that works in bash is not working through system() or shell().

While I have a working solution through RStudio now, I'm still wondering why this doesn't work.

I know this is an old thread, but @milesmcbain shared a great syntax highlighter on Twitter earlier this year that I think is work sharing here. Y'all should check it out if you haven't found it already.

https://github.com/anthonynorth/rscodeio