3

我正在使用下面的代码与我的朋友共享数据框“my_data1”,并且代码运行良好。但我有另一个要分享的数据框“my_data2”。请建议我应该在哪里以及如何在我的代码中添加第二个表

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)
4

1 回答 1

3

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

当您想在两个表格之间插入一些文本时,您可以执行以下操作:

<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>
于 2016-03-17T10:00:09.277 回答