Copying tables from R to Outlook

I work in an ecosystem that uses Outlook for e-mail. When I have to communicate results with collaborators one of the most frequent tasks I face is to take a tabular output in R (either a summary table or some sort of tabular output) and send it to collaborators in Outlook. One method is certainly to export the table to Excel  and then copy the table from there into Outlook. However, I think I prefer another method which works a bit quicker for me.

I’ve been writing full reports using Rmarkdown for a while now, and it’s my preferred report-generation method. Usually I use knitr::kable to generate a Markdown version of a table in R. I can then copy the generated Markdown version of the table into a Markdown editor (I use Minimalist Markdown Editor), then just copy the HTML-rendered table from the preview pane to Outlook. This seem  to work pretty well for me



  1. I create entire reports (like over 700 pages) in R using markdown to HTML. I then rename the HTML file with the extension “doc” and open it in MS Word. When you learn a little HTML, you can have complete control over the look of your report by putting HTML directly into your code using cat(). For example;
    cat(‘ Some text ‘)
    The HTML is passed through and processed by MS Word. Fancy tables can be achieved by using HTML output option on the table functions in sjPlot package.

    1. Note that my comment above is not what I typed. The comment posting software removed the HTML from the cat() example! It contained HTML to define a paragraph with red text. All that is displayed in ‘Some text’.

      1. I’m on mobile right now, so i cant quite check. It might be a issue. I just approved.

    2. I use that pipeline all the time, to create reports and papers. However, the use case I’m describing is for interim analytic results that I need to share with colleagues, and I’m not creating Rmd files for. A colleague wants to see results for one analysis, which I’m describing in a R file. This is my way of sharing that one table quickly.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s