save R object into a remote directory

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

save R object into a remote directory

Simone Tenan
Hi all,
I'm using R remotely via ssh connection in linux. I need to save a large R
object from the remote server to my laptop. How can I specify the path in
the save() function?

Thanks much for your help,
Simone

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: save R object into a remote directory

Rainer Krug-3
Simone Tenan <[hidden email]> writes:

> Hi all,
> I'm using R remotely via ssh connection in linux. I need to save a large R
> object from the remote server to my laptop. How can I specify the path in
> the save() function?

You are working on the remote machine and there is no way that you can
specify "out of the box" a save to client machine (I stand to be corrected).

You could mount a directory on the client on the server, but I would
suggest to

1) save the object on the server (the where R is running on)
2) use scp from the client to copy the file from the server to the
client (the one you are typing on).

scp user@host1:file1 ./TheNameOfTheLocalFile

Cheers,

Rainer

>
> Thanks much for your help,
> Simone
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

signature.asc (463 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: save R object into a remote directory

Rainer Krug-3
Please reply to the mailing list to keep the conversation available for
everybody. I Send this mail to the mailing list as well.

Simone Tenan <[hidden email]> writes:

> Thanks Rainer,
> it's very kind of you.
> Unfortunately, I cannot save the (large) R object where the current R session is running. There is not enough memory and when I tried I got the error "error
> writing to connection".

OK - essential piece of information.

In this case, your best bet is trying to mount an a flder from your
client on the server and than save there.

Contact you administrator to find out if this is possible or (s)he has
other suggestions.

> For that reason I was trying to save the object of of the remote server.
>
> Best,

Cheers,

Rainer

> Simone
>
> On 6 September 2016 at 10:30, Rainer M Krug <[hidden email]> wrote:
>
>  Simone Tenan <[hidden email]> writes:
>
>  > Hi all,
>  > I'm using R remotely via ssh connection in linux. I need to save a large R
>  > object from the remote server to my laptop. How can I specify the path in
>  > the save() function?
>
>  You are working on the remote machine and there is no way that you can
>  specify "out of the box" a save to client machine (I stand to be corrected).
>
>  You could mount a directory on the client on the server, but I would
>  suggest to
>
>  1) save the object on the server (the where R is running on)
>  2) use scp from the client to copy the file from the server to the
>  client (the one you are typing on).
>
>  scp user@host1:file1 ./TheNameOfTheLocalFile
>
>  Cheers,
>
>  Rainer
>
>  >
>  > Thanks much for your help,
>  > Simone
>  >
>  > [[alternative HTML version deleted]]
>  >
>  > ______________________________________________
>  > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>  > https://stat.ethz.ch/mailman/listinfo/r-help
>  > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>  > and provide commented, minimal, self-contained, reproducible code.
>
>  --
>  Rainer M. Krug
>  email: Rainer<at>krugs<dot>de
>  PGP: 0x0F52F982
>
>
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      [hidden email]

Skype:      RMkrug

PGP: 0x0F52F982

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

signature.asc (463 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: save R object into a remote directory

Peter Dalgaard-2

On 06 Sep 2016, at 11:00 , Rainer M Krug <[hidden email]> wrote:

> Please reply to the mailing list to keep the conversation available for
> everybody. I Send this mail to the mailing list as well.
>
> Simone Tenan <[hidden email]> writes:
>
>> Thanks Rainer,
>> it's very kind of you.
>> Unfortunately, I cannot save the (large) R object where the current R session is running. There is not enough memory and when I tried I got the error "error
>> writing to connection".
>
> OK - essential piece of information.
>
> In this case, your best bet is trying to mount an a flder from your
> client on the server and than save there.


I think you can in principle do something with a socketConnection and SSH port forwarding, but it is not trivial.

> Contact you administrator to find out if this is possible or (s)he has
> other suggestions.
>

yep.

>> For that reason I was trying to save the object of of the remote server.
>>
>> Best,
>
> Cheers,
>
> Rainer
>
>> Simone
>>
>> On 6 September 2016 at 10:30, Rainer M Krug <[hidden email]> wrote:
>>
>> Simone Tenan <[hidden email]> writes:
>>
>>> Hi all,
>>> I'm using R remotely via ssh connection in linux. I need to save a large R
>>> object from the remote server to my laptop. How can I specify the path in
>>> the save() function?
>>
>> You are working on the remote machine and there is no way that you can
>> specify "out of the box" a save to client machine (I stand to be corrected).
>>
>> You could mount a directory on the client on the server, but I would
>> suggest to
>>
>> 1) save the object on the server (the where R is running on)
>> 2) use scp from the client to copy the file from the server to the
>> client (the one you are typing on).
>>
>> scp user@host1:file1 ./TheNameOfTheLocalFile
>>
>> Cheers,
>>
>> Rainer
>>
>>>
>>> Thanks much for your help,
>>> Simone
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>> --
>> Rainer M. Krug
>> email: Rainer<at>krugs<dot>de
>> PGP: 0x0F52F982
>>
>>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel :       +33 - (0)9 53 10 27 44
> Cell:       +33 - (0)6 85 62 59 98
> Fax :       +33 - (0)9 58 10 27 44
>
> Fax (D):    +49 - (0)3 21 21 25 22 44
>
> email:      [hidden email]
>
> Skype:      RMkrug
>
> PGP: 0x0F52F982
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: [hidden email]  Priv: [hidden email]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: save R object into a remote directory

Henrik Bengtsson-5
In reply to this post by Rainer Krug-3
On Tue, Sep 6, 2016 at 2:00 AM, Rainer M Krug <[hidden email]> wrote:

> Please reply to the mailing list to keep the conversation available for
> everybody. I Send this mail to the mailing list as well.
>
> Simone Tenan <[hidden email]> writes:
>
>> Thanks Rainer,
>> it's very kind of you.
>> Unfortunately, I cannot save the (large) R object where the current R session is running. There is not enough memory and when I tried I got the error "error
>> writing to connection".
>
> OK - essential piece of information.

Assuming the remote machine you're logging into is running Linux:

Before anything else, did you try to save elsewhere than to your
/home/ folder/account? Try /tmp/.  That probably / hopefully doesn't
count to your account quota (and it gets wiped at every reboot).
There's also /var/tmp/ (a bit more persistent storage - survives
reboots).

/Henrik

PS. In R, the tempdir() function often points to a directory under
/tmp/, e.g.  tempdir() => "/tmp/RtmpWZPsip".  However, that will be
wiped by R itself when you quit the R session, so if you use tempdir()
you need to scp that file before you quit R.  It's probably better to
avoid tempdir() in your case.

>
> In this case, your best bet is trying to mount an a flder from your
> client on the server and than save there.
>
> Contact you administrator to find out if this is possible or (s)he has
> other suggestions.
>
>> For that reason I was trying to save the object of of the remote server.
>>
>> Best,
>
> Cheers,
>
> Rainer
>
>> Simone
>>
>> On 6 September 2016 at 10:30, Rainer M Krug <[hidden email]> wrote:
>>
>>  Simone Tenan <[hidden email]> writes:
>>
>>  > Hi all,
>>  > I'm using R remotely via ssh connection in linux. I need to save a large R
>>  > object from the remote server to my laptop. How can I specify the path in
>>  > the save() function?
>>
>>  You are working on the remote machine and there is no way that you can
>>  specify "out of the box" a save to client machine (I stand to be corrected).
>>
>>  You could mount a directory on the client on the server, but I would
>>  suggest to
>>
>>  1) save the object on the server (the where R is running on)
>>  2) use scp from the client to copy the file from the server to the
>>  client (the one you are typing on).
>>
>>  scp user@host1:file1 ./TheNameOfTheLocalFile
>>
>>  Cheers,
>>
>>  Rainer
>>
>>  >
>>  > Thanks much for your help,
>>  > Simone
>>  >
>>  > [[alternative HTML version deleted]]
>>  >
>>  > ______________________________________________
>>  > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>  > https://stat.ethz.ch/mailman/listinfo/r-help
>>  > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>  > and provide commented, minimal, self-contained, reproducible code.
>>
>>  --
>>  Rainer M. Krug
>>  email: Rainer<at>krugs<dot>de
>>  PGP: 0x0F52F982
>>
>>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel :       +33 - (0)9 53 10 27 44
> Cell:       +33 - (0)6 85 62 59 98
> Fax :       +33 - (0)9 58 10 27 44
>
> Fax (D):    +49 - (0)3 21 21 25 22 44
>
> email:      [hidden email]
>
> Skype:      RMkrug
>
> PGP: 0x0F52F982
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.