I'm hoping to generate an email once my markdown has been completed, with some data and a few ggplots embedded in the body of the email.
I've been able to get it to produce text I want using the code below, however I've been unable to get it to insert the 3 ggplots I need into the body as images (or in any form by that matter) underneath the text I've got.
subject_1 <- "Time Update"
subject_2 <- paste0('(', current_time_round,')')
email_body <- paste("<div style='font-family:calibri'><p>Hi</p>
<p>Please see below for the Time update. Data was calculated at", current_time_round,"</p>",
"<li>", "Specific Vol:", paste0(specific_vol, "%</li>"), "</div>")
date <- as.Date(Sys.time())
email_subject <- paste(subject_1, date, subject_2)
OutApp <- COMCreate("Outlook.Application")
Email = OutApp$CreateItem(0)
Email[["to"]] = target
Email[["subject"]] = email_subject
Email[["htmlbody"]] = email_body
Email$Display()
The ggplots are stored as objects with the names, "rz", "rs", & "rp". I've tried a number of different methods, including this one: RDCOMClient (Outlook) - ggplot
However that just delivers an error on the images and seems to interfere with the data. Any advice on how I can get it working would be very appreciated.