아래와 같이 데이터 프레임이 있습니다. 그런 다음 데이터 프레임을 html 테이블로 변환합니다.테이블에서 데이터 프레임을 포함하여 Outlook에서 전자 메일 보내기 R
# Use RDCOMClient to send email from outlook
library(RDCOMClient)
# Use xtable to convert dataframe into html table
library(xtable)
# Create dataframe
df <- as.data.frame(mtcars[1:3,1:3])
# Create HTML object
df_html <- xtable(df)
지금, 나는 내 이메일의 본문의 전자 메일 스레드 Sending email in R via outlook
## init com api
OutApp <- COMCreate("Outlook.Application")
## create an email
outMail = OutApp$CreateItem(0)
## configure email parameter
outMail[["To"]] = "[email protected]"
outMail[["subject"]] = "some subject"
outMail[["body"]] = df_html
## send it
outMail$Send()
에 주어진 멋진 솔루션을 사용하여 전망에서 이메일을 보내고, 내가 원하는 데이터 프레임 DF를 원하는 HTML 테이블로 첨부하십시오. 위 코드를 실행하면 아래 오류 메시지가 나타납니다. 내가 outMail[["body"]] = df_html
outMail[["body"]] = paste0(df_html)
에 라인을 변경하는 경우
Error in `[[<-`(`*tmp*`, "body", value = list(mpg = c(21, 21, 22.8), cyl = c(6, :
Can't attach the RDCOMServer package needed to create a generic COM object
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘RDCOMServer’
, 나는 이메일을하지만 출력은 테이블로되지 않습니다. 그것은 나의 전망에서 아래에 보이는 것과 같이 온다.
c(21, 21, 22.8), c(6, 6, 4), c(160, 160, 108)
나는 이것이 테이블이되고 싶다. 내가 어떻게 이걸 얻을 수 있니? 감사!
친애하는 전문가, R에서이 문제를 해결하는 방법에 대한 제안? –
링크에서 제공 한이 문제에 대한 부분적인 해결책이 있습니다 - https://stackoverflow.com/questions/47248728/html-table-output-formatting-when-sending-email-from-microsoft-outlook-using- 아르 자형. 그러나 나는 위의 링크에서 볼 수있는 새로운 질문을 한 또 다른 문제에 부딪혔다. –