12.7 PDF via knitr/R Markdown

Using the default settings and the unmodified Markdown file above gets us close.

Knitting to Microsoft Word from R Markdown. Before (A) and after (B) adjustment.

FIGURE 12.3: Knitting to Microsoft Word from R Markdown. Before (A) and after (B) adjustment.

Again, this is not bad, but has issues (Figure 12.3A).

We can fix the plot in exactly the same way, but the table is off the side of the page. For this we use the kableExtra package. Install this in the normal manner. You may also want to alter the margins of your page using geometry in the preamble.

This now looks better (Figure 12.3B).