[R] eMail results out of R

(Ted Harding) ted.harding at nessie.mcc.ac.uk
Thu Jul 12 18:25:24 CEST 2007


On 12-Jul-07 13:52:56, thomas.schwander at mvv.de wrote:
> Hi everyone,
> 
> I did my homework and read the posting guideline :-)
> 
> I want to eMail the results of a computing automatically. So I get the
> results (the parameters of a garch process) and I want to eMail them to
> another person. How can I do that?
> 
> Thx

As well as the answers from John Scillieri and Duncan Murdoch:
if it does happen that you're using a Unix/Linux system, then
the appropriate variant of the following illustration will work
(the 'mail' command should always be present on variants of these
systems):

In the little project I'm working on in R at the moment,
I have variables x1 and x2 (each length-50 numeric vectors).

So I can, in R, do:

  sink(file="myoutput")
  cbind(x1,x2)
  sink()
  system("mail ted -s \"Test No 2\" < myoutput")

which has stored the 2-column output from cbind(x1,x2) in the
file "myoutput", and then used the 'mail' command to mail its
contents to 'ted' with subject 'Test No 2' (I used a multi-word
subject to illustrate the quotes the command line will need,
to avoid splitting the subject into separate tokens).

See ?sink for how to use the sink() command.

Then 'ted' duly received an email with contents:

===========================================
Date: Thu, 12 Jul 2007 17:10:44 +0100
From: Ted Harding <ted at compo.fort.knox.uk>
To: ted at compo.fort.knox.uk
Subject: Test No 2

               x1           x2
 [1,]  0.37282844  0.002743146
 [2,]  0.93293155 -0.108009247
 .......
[49,] -0.08681427  0.828313288
[50,] -0.23621908  0.385269729
===========================================

You can of course encapsulate something like the above sequence
of commands into an R function, depending on how you organise the
storage of the results you want to email.

Hoping this helps,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 12-Jul-07                                       Time: 17:25:05
------------------------------ XFMail ------------------------------



More information about the R-help mailing list