[R] save R object into a remote directory
Henrik Bengtsson
henrik.bengtsson at gmail.com
Tue Sep 6 19:15:40 CEST 2016
On Tue, Sep 6, 2016 at 2:00 AM, Rainer M Krug <Rainer at krugs.de> 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 <tenan.simone at gmail.com> 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 <Rainer at krugs.de> wrote:
>>
>> Simone Tenan <tenan.simone at gmail.com> 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 at host1:file1 ./TheNameOfTheLocalFile
>>
>> Cheers,
>>
>> Rainer
>>
>> >
>> > Thanks much for your help,
>> > Simone
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > R-help at r-project.org 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: Rainer at krugs.de
>
> Skype: RMkrug
>
> PGP: 0x0F52F982
>
> ______________________________________________
> R-help at r-project.org 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.
More information about the R-help
mailing list