user42174
user42174

Reputation: 765

Get R's computation results from a distant computer

Let's say that R is running a computation on Computer A.

Can computer B "take a look" at how this R computation is going on computer A?

Can R send the output (maybe even the created files) to a computer B when the computation is done?

I know R has a sink() function but I don't know how to use it with a distant computer, or even if that woukd be an appropriate way to set things up for my purpose. Should I use a SSH tunnel (whatever that means)?

@Enrico & @Señor O:

Computers A and B are PCs. I don't have admin rights on computer A, so I probably can't install a SSH server or "mount" computer B (does it mean creating a network?) on it.

Maybe I can send myself an email from R though? Saying something like "computation reached this point, here is the output so far..."

I just found here that this might be easily set up. Apparently you can even twitter from R!

Upvotes: 1

Views: 73

Answers (2)

enricoferrero
enricoferrero

Reputation: 2319

If I understand your question, you should be able to do this quite easily with a combination of ssh and tmux (or screen).

Computer A must have a ssh server running.

user@computerB$ ssh computerA.domain.com
user@computerA$ tmux new
user@computerA$ R
> source("myAnalysis.R")
...

Press Ctrl-b d to detach and then Ctrl-d to disconnect from computer A. Now you can shut down your computer, go for a walk, whatever. Then:

user@computerB$ ssh computerA.domain.com
user@computerA$ tmux a
>

R will still be running.

Upvotes: 2

iacobus
iacobus

Reputation: 597

You should be able to open the .Rout file if you run R in batch mode without interrupting the job. Copy it and open the copy to be extra-safe. As to copying the output, it might be easiest to write a bash script to run R in batch mode and then scp the output files once the job is done.

Upvotes: 0

Related Questions