Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I email myself data from a R script?

Tags:

r

amazon-ec2

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.

like image 527
Maiasaura Avatar asked Aug 12 '10 00:08

Maiasaura


People also ask

Can you email in R code?

This is where the blastula package comes in. blastula allows you to create and send e-mails using R. It works similarly to the Shiny package, but instead of writing R code to create an interactive application, you write R code to create an HTML e-mail that can be rendered across a wide variety of e-mail providers.


1 Answers

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.

like image 148
Dirk Eddelbuettel Avatar answered Sep 19 '22 16:09

Dirk Eddelbuettel