Automating Knitting a Word doc and emailing it with R
Yes, there is... at least definitely if you are sending from a gmail account.
I use library(emayili)
to send emails from my code often.
I believe something like this might work for you:
recipients <- c("email address 1", "email address 2")
email <- envelope() %>%
from("senders email account") %>%
to(recipients) %>%
subject("subject") %>%
text("body") %>% attachment("file name", path = "file path as saved onto your pc")
smtp <- server(host = "smtp.gmail.com",
port = 465,
username = "your email username",
password = "your email password")
smtp(email, verbose = TRUE)
I did notice that to actually attach the file, you need to have a body to the email as well. Not just the attachment.
That's the email part.
For the knitting part, try something like this
rmarkdown::render("AutomationPricingReport.Rmd",
output_file = "AutomationPricingReport.docx"
)
As Jon Spring pointed out in the comments, library(taskscheduleR)
is probably your best bet to automate running the script.
Appending MS Word DOC files with Perl programming
I think, you can try to solve your task with the Win32::Clipboard
Perl module. That is the good start point. Additional information you can find here: http://www.perl.com/pub/2005/05/26/word_control.html.
Another module that can be useful for you is Win32::OLE
. Small example of usage: http://www.adp-gmbh.ch/perl/word.html
Related Topics
Plot Line and Bar Graph (With Secondary Axis for Line Graph) Using Ggplot
Missing Data When Supplying a Dual-Axis--Multiple-Traces to Subplot
Extract Data Between a Pattern from a Text File
Text Mining R Package & Regex to Handle Replace Smart Curly Quotes
Is There a Limit for the Possible Number of Nested Ifelse Statements
How to Print a Variable Inside a for Loop to the Console in Real Time as the Loop Is Running
How to 'Unlist' a Column in a Data.Table
R Sum Every K Columns in Matrix
Let Ggplot2 Histogram Show Classwise Percentages on Y Axis
Store Arrangegrob to Object, Does Not Create Printable Object
Match Two Columns with Two Other Columns
R - Svd() Function - Infinite or Missing Values in 'X'
Accessing Y Columns with Duplicated Names in J of X[Y, J] Merges
R How to Remove Rows in a Data Frame Based on the First Character of a Column
"Object Not Found" Error Within a User Defined Function, Eval() Function
Force Facet_Wrap to Fill Bottom Row (And Leave Any "Gaps" in the Top Row)