[R] saving (and loading) environment to/from a connection?

David Reiss dreiss at systemsbiology.org
Tue Nov 14 23:49:02 CET 2006


Hi,
I apologize if this is an FAQ but I could not find references to it anywhere.
I am trying to send the entire "environment" from one R session to
another (on a remote machine) using socketConnections. However, I
cannot get around this error:

On "host" machine:

> con1=socketConnection(port=6011,server=T,open="w+b",blocking=T)
> save(list=ls(),file=con1)

On "client" machine:

> con2=socketConnection("localhost",port=6011,open="r+b",blocking=T)
> load(con2)

Error in gzcon(con, level, allowNonCompressed) :
        can only use read- or write- binary connections

I seem to get this error even if I use the "compress=F" option in
save(). Also, it doesnt matter if I use "r+b" or "rb" (and "w+b" vs.
"wb"), or whether I use blocking or not.

I am able to see that the data is getting sent, as when I use readBin(con2...).

Does anyone know how to do this?
thanks very much.
-David



More information about the R-help mailing list