如何在电子邮件正文中嵌入交互式图表

时间:2016-01-09 14:39:50

标签: r email dygraphs

我正在测试dygraphs,我想要的是生成一个html文件,然后通过电子邮件发送它,以便outlook可以打开它,我看到正文中的内容(不只是附件)

这是this post

的扩展

这是dygraphs.Rmd

---
output:
  html_document:
    fig_width: 6
    fig_height: 4
    self_contained: no
---

```{r}
require(dygraphs)
dygraph(nhtemp, main = "New Haven Temperatures", ylab = "Temp (F)") 
```

以下代码可以使用并发送电子邮件(dygraphs.r)

library(dygraphs)
library(mailR)
library(rmarkdown)

send <- function(subject, body){
  send.mail(from = "me",
            to = "me",
            subject = subject,
            html = T,
            inline = T,
            body = body,
            smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "me", passwd = "pwd", ssl = T),
            authenticate = T,
            send = T)
}

knitr::knit2html(input='dygraphs.Rmd', output='dygraphs_knitr.html',options = "")
rmarkdown::render('dygraphs.Rmd','html_document','dygraphs_rmarkdown.html')
send('dygraphs_knitr', 'dygraphs_knitr.html')
send('dygraphs_rmarkdown', 'dygraphs_rmarkdown.html')

我这样做,我收到了电子邮件,但图表没有呈现。 是否有解决方法(如果可能的话)?

0 个答案:

没有答案