'Print R variables in generated email. Is there a better way of doing it?

I'm hoping to generate an email once my markdown has been completed, populated with information and some of the ggplots in the body of the email. However, I'm running into a little bit of a snag; R objects are not being printed in the htmlbody, and therefore when I get round to adding the ggplots they will also not work. Does anyone have any ideas on how I can get this working?

Code is below (Ideally the subject_1, subject_2 method is not the way I think I need to head):

subject_1 <- "Time Update"
subject_2 <- paste0('(', current_time_round,')')
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"]] = "<p>Hi Everyone,</p>
<p>Please see attached, and below for the Time update. All data calculated to `r current_time_round`</p>"

Email$Display()

Appreciative of any advice/pointers.

EDIT: The current_time_round doesn't print the number.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source