tags:

views:

148

answers:

2

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.

+8  A: 

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 [email protected]")

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
Hrmmm, any thoughts on how to do this with windows?
Brandon Bertelsen
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
[blat](http://www.blat.net) is what I was thinking of as what had been recommended by others.
Dirk Eddelbuettel
Eh, another request :) What about Mac OS X ? Is there something like mpack or a (non-fink) way to install it?
ran2
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
+1  A: 

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