Nikitau
Nikitau

Reputation: 371

Difficulty in inserting HTML output table from R into Outlook

I created a HTML table in R using the package HTMLTable. However, the output generated from HTMLTable shows up terribly in Outlook. It's basically almost unreadable. The borders don't show up in Outlook at all, and spacing is far too large. I know the output from R2HTML works in Outlook, but as far as I know I can't get up the <HTML></HTML> tags to show up with R2HTML.

Help or advice would be much appreciated. Below is the current code I'm using to export my .html table:

htmltools::save_html(htmlTable::htmlTable(data), file = "data")

Upvotes: 0

Views: 291

Answers (1)

Ian Wesley
Ian Wesley

Reputation: 3624

This will add the HTML tags to the saved file:

mytableout <-htmlTable(data)

sink("data.html")
cat("<head>")
print(mytableout,type="html",useViewer=TRUE)
cat("</head>")
sink()

Upvotes: 1

Related Questions