8

I'm hoping to take advantage of Amazon spot instances which come at a lower cost but can terminate anytime. I want to set it up such that I can send myself data mid-way through a script so I can pick up from there in the future.

How would I email myself a .rdata file?

difficulty: The ideal solution will not involve RCurl since I am unable to install that package on my machine instance.

Maiasaura
  • 32,226
  • 27
  • 104
  • 108

3 Answers3

8

The same way you would on the command-line -- I like the mpack binary for that which you find in Debian and Ubuntu.

So save data to a file /tmp/foo.RData (or generate a temporary name) and then

 system("mpack -s Data /tmp/foo.RData you@some.where.com")

in R. That assumes the EC2 instance has mail setup, of course.

Edit Per request for a windoze alternative: blat has been recommended by other for this task.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • Hrmmm, any thoughts on how to do this with windows? – Brandon Bertelsen Aug 12 '10 at 02:43
  • Yes, *the same way you would on the command-line*. There are tools for Windows that emulate the cmdline Unix mail behaviour. Google it... I have forgotten the details as it have been years that I would have needed such a tool. Solutions are in the r-help archives, among other places. – Dirk Eddelbuettel Aug 12 '10 at 03:11
  • 1
    [blat](http://www.blat.net) is what I was thinking of as what had been recommended by others. – Dirk Eddelbuettel Aug 12 '10 at 03:20
  • Eh, another request :) What about Mac OS X ? Is there something like mpack or a (non-fink) way to install it? – Matt Bannert Aug 12 '10 at 07:53
  • You could a) compile it from source yourself or b) replace it with a Perl or Python script which mime-wraps and then mails. – Dirk Eddelbuettel Aug 12 '10 at 12:09
2

There is a good article on this in R News from 2007. Amongst other things, the author describes some tactics for catching errors as they occur, and automatically sending email alerts when this happens -- helpful for long simulations.

Off topic: the article also gives tips about how the linux/unix tools screen and make can be very useful for remote monitoring and automatic error reporting. These may also be relevant in cases when you are willing to let R email you.

nullglob
  • 6,903
  • 1
  • 29
  • 31
0

What you're asking is probably best solved not by email but by using an EBS volume. The volume will persist regardless of the instance (note though that I'm referring to an EBS volume as opposed to an EBS-backed instance).

In another question, I mention a bunch of options for checkpointing and related tools, if you would like to use a separate function for storing your data during the processing.

Community
  • 1
  • 1
Iterator
  • 20,250
  • 12
  • 75
  • 111