通过sendmailR共享2个数据表

sharing 2 data tables through sendmailR

我正在使用以下代码与我的朋友共享数据框 "my_data1",代码运行良好。但是我有另一个数据框 "my_data2" 想分享。请建议我应该在哪里以及如何在我的代码

中添加第二个table
library(sendmailR)
library(pander)
from <- "<me@gmail.com>"
to <- "<friend@gmail.com>"
subject <- "Important Report of the Day!!"
body <- "This is the result of the test:"                     
mailControl=list(smtpServer="ASPMX.L.GOOGLE.COM")
#-----------------------------------------------------


#-----------------------------------------------------
msg_content <- mime_part(paste('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body><pre>', paste(pander_return(pander(my_data1, style="multiline", caption = "Net Bookings")), collapse = '\n'), '</pre></body>
</html>'))

msg_content[["headers"]][["Content-Type"]] <- "text/html"

sendmail(from=from,to=to,subject=subject,msg=msg_content,control=mailControl)

</pre></body> 之间添加 <p><pre>', paste(pander_return(pander(my_data2, style="multiline", caption = "New Caption")), collapse = '\n'), '</pre> 应该会给你想要的结果。

当你想在两个表之间插​​入一些文本时,你可以这样做:

<p>the text you want to insert between the tables</p>
<pre>', paste(pander_return(pander(my_data2, style="multiline", caption = "New Caption")), collapse = '\n'), '</pre>