Is it possible to send visualizations through RDCOM?

佐手、 提交于 2019-12-05 22:21:39

Sure, first you save your image. Then use HTMLbody to insert the image using HTML code as follows:

library(htmlTable)

png("pictest.png")
plot(iris$Sepal.Length)
dev.off()

StockPrice <- "25.25"

MyHTML <- paste0("<html><p>This is a picture.</p> 
<img src='C:/Users/iwes/Desktop/RWorkingFolder/pictest.png' >
<p> Our StockPrices is: $", StockPrice,
"<p>here is a table:</p>",
htmlTable(head(iris,5)))

library(RDCOMClient)
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(0)
outMail[["To"]] = "test@test.com"
outMail[["subject"]] = "R Test"
outMail[["HTMLbody"]] =  MyHTML                  
outMail$Send()
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!