I'm using Rstudio to make a markdown document which I want to convert to a word document. I would like to change word template that is automatically generated when you knit to Word. For example, I want the margins to be narrow when I knit to word.
I'm on a Windows 64 bit, with Windows 7.
To transform your markdown file into an HTML, PDF, or Word document, click the “Knit” icon that appears above your file in the scripts editor. A drop down menu will let you select the type of output that you want. When you click the button, rmarkdown will duplicate your text in the new file format.
The usual way to compile an R Markdown document is to click the Knit button as shown in Figure 2.1, and the corresponding keyboard shortcut is Ctrl + Shift + K ( Cmd + Shift + K on macOS). Under the hood, RStudio calls the function rmarkdown::render() to render the document in a new R session.
You can create a template for every homework assignment or exercise that you want your students to work through. And they can access all of these templates easily when they go to File > New File > R Markdown . And then select From Template from the dialogue box menu. Your custom R Markdown template will appear there.
I prepared a video for this task. Please see if it helps. Basically you generate a Word document from an arbitrary R Markdown document, then modify the styles in the Word output document, and use this document as the template for future R Markdown documents.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With