Positioning table in Rmarkdown knitted to Word Document

Hello Everyone,

I am creating a Markdown document that is knitted to Microsoft Word.

I intend to produce many different versions of this document by using a single RMarkdown template with different data sources. One version of the document will be produced for specific industries as defined by NAICS codes.

Consequently, I want to use RStudio and RMarkdown to automate as much of the document production process as possible.

One process that I haven't been able to automate is positioning tables in the Word document and wrapping test around those tables in the Word document. Right now, text occurs above and below tables, only.

Of course, after knitting to the Word document, I could wrap text around the tables in the Word document manually by using the built-in positioning tools in MS Word, but the glory of RMarkdown is that I can format a document once without having to make redundant, manual formatting changes in a document.

I suspect this will include specifying that the table must be placed to the left side, right side or center of the document page, as appropriate followed by specifying that the text will wrap around the table.

Has anyone discovered a programmatic method to specify how to wrap text around the table in the Word document?

What I want:

What I get:

I've been searching the various online sources of code snippets without finding an answer. Even suggestions of appropriate search keywords might help me find code snippets to accomplish this.

Thanks in advance for your help.


Have you tried officer https://davidgohel.github.io/officer/articles/offcran/tables.html. I have not used but many people seem to find a worthy method.

Good luck

1 Like

I have seen that post and I'll take another, closer look at it to see if it can help. Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.