[R] R and SSH / exchange R objects between client and server

Duncan Murdoch murdoch.duncan at gmail.com
Tue Jan 1 21:39:17 CET 2013

On 13-01-01 2:42 PM, Martin Batholdy wrote:
> Hi,
> I have a laptop (Mac OS) and a remote PC (Ubuntu) and would like to do the heavy work on the remote machine but control it via the laptop.
> I managed to install ssh server and can now remotely connect to my PC via ssh and can start an R session in the terminal.
> However, I still don't quite understand how I can now "exchange" R objects.
> I have the raw data I want to read and analyse on my laptop.
> So I need to read the files on the laptop and 'send' the r object to the remote PC.
> The remote PC should then do the heavy calculations and send back the result data frames, so that I can export/save the result tables on my laptop.
> Is this even possible with ssh (send R objects from client to server and vice versa)?

Use save() and load() to create and read binary files containing the 
objects you want to exchange.  Use scp to move them between systems. 
(Or sftp, or something else to move files.)

> Are there R packages who help to establish ssh connections?

Not that I know of.  You just use the command line utilities via 
system() or shell().

> Can I also connect to the server via the R gui?

Not with base R.  There are some front ends written by others that do 
this, e.g. RStudio.

Duncan Murdoch

More information about the R-help mailing list