I'm creating a plot using the forecast package- it includes the ability to generate a plot of a forecast generated with base plot.
I tried using recordPlot to save the plot to a variable, which allows me to recreate the plot in an interactive session. However, what I'd like to do (on a remote server) is generate the plot, save it to a variable and then include it as a mime_part when emailing it to myself using the sendmailR package.
The plot (named plt in the example below) does not show up in the email as it would if it were a ggplot2 object. Is there a way to send a base plot via sendmailR?
sendmail(from = email_from,
to = email_to,
subject = email_subject,
msg=c(plt,
email_body_text, "\n", "\n",
mime_part(results, "query results", sep = ",", row.names = FALSE), "\n",
"\n", "SQL query that generated this result:", "\n", "\n",
query
)
)