bluemouse
bluemouse

Reputation: 472

Workflow for using command line R?

I am used to using R in RStudio. For a new project, I have to use R on the command line, because the data storage and analysis are only allowed to be on a specific server that I connect to using ssh. This server doesn't have rstudio-server to support remote RStudio sessions.

The project involves an extremely large dataset, and some pre-written code to load/format the data that I have been told to run using "source()" before I do anything else. This takes several minutes to run and load the data each time.

What would a good workflow be for something like this? Editing my code in a .r file, saving, then running it would require taking several minutes to load the data each time. But just running R in an interactive session would make it hard to keep track of what I am doing and repeat things if necessary.

Is there some command-line equivalent to RStudio where you can have an interactive session but be editing/saving a file of your code as you go?

Upvotes: 2

Views: 153

Answers (2)

JustGettinStarted
JustGettinStarted

Reputation: 834

For RStudio you can launch console and ssh to your remote servers even if your servers don't use expensive RStudio for servers platform. You can then execute all commands from R Studio directly into the ssh with the default shortcut key. This might allow to continue using R studio, track what you're doing in the R script, execute interactively.

Upvotes: 0

Frames Catherine White
Frames Catherine White

Reputation: 28212

Sounds like JuPyteR might be your friend here. The R kernel works great.

You can use it on a remote server either with exposing an open port (and setting up JuPyteR login credentials) Or via port forwarding over SSH.

It is a lot like an interactive reply, except it holds state. And you can go back and rerun cells. (Of course state can be dangerous for reproduceability)

Upvotes: 2

Related Questions