[R] R and SSH / exchange R objects between client and server
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Jan 1 22:17:19 CET 2013
On 01/01/2013 20:39, Duncan Murdoch wrote:
> 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.)
You could use package 'parallel' to run workers on the 'remote PC'.
There are also packages like Rserve (http://www.rforge.net/Rserve/, and
also RSclient).
>> 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().
Yes, but e.g. parallel does have wrappers.
>
>> 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.
The 'R gui'? You mean R.app on OS X? That's just like any other R
console, so you can via parallel or RSclient.
A lot of the messy details are already taken care of via package
parallel, so that is where I would start. Simple use makeCluster to set
up a cluster of size 1 on the remote machine, clusterExport to transfer
and clusterCall to submit tasks.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list