Sending R Reports via email
Contents
Some days ago I found a post on R-bloggers.com about Scheduling R Markdown Reports via email. The original post can be found here.
Unfortunately this article describes the sending of emails on Windows systems. So let me show you how I send R Reports on a Linux system.
Report Generation
First I need to generate the report. As I wrote last year I prefer to create pdf-reports using knitr and LaTeX.
So let’s say the report is Report.Rnw. First we have to generate a LaTeX-file:
|
|
Then we need to generate the pdf-file.
|
|
Sending the email
With the unix tool mail we send the document as attachment.
|
|
Bash script with some configuration
So let’s wrap it up and put the commands in a bash-file
|
|
Scheduling
Use the crontab-command to schedule the execution of this script:
|
|
Now an editor pops up to edit the crontab. Most likely it’s vi. Be sure to know how to use it. That’s out of scope of this artice. Maybe you want to take a look at this tutorial.
The following line executes the script every monday at 7 am:
|
|