Chapter 7 Previews and collaborations
One of the reasons I have fallen so completely in love with R Markdown is it lets me putter away in my ideal workflow (do stuff in R, integrate directly in document, have full control over style parameters), AND honour my supervisor’s desire to receive .docx documents.
While my final output will be rendered as a PDF, and my interim document will be rendered as HTML, the drafts that get sent to my supervisor must be in Word.
As previously mentioned, bookdown specifically has a function to render previews. You can read more about that here. This option is helpful for seeing exactly what that chapter will look like in the final version.
I strayed away from this option because sometimes I found myself wanting to send my supervisor multiple parts of my dissertation at once (e.g., part of the methods, part of the results), but I don’t care if he sees the front matter of the dissertation skeleton. To do this, I have the following protocol in place:
- Sub-directory called
previews
that contains one file:render_preview.Rmd
render_preview
contains:- minimal YAML required to output a legible .docx file
- minimal setup chunk identical to what I have in
index.Rmd
- chunks that call child documents; a way to input specific .Rmd files as-is into a main .Rmd “parent” document (in this case,
render_previews.Rmd
is the parent)
render_preview.Rmd
Sending a draft preview
- When I’m ready to send a partial draft to my supervisor, I input the relevant child documents and knit
render_previews.Rmd
. I then name it something useful and send it to him. - He may mark it up and send it back to me with tracked changes
- I then incorporate these tracked changes by hand into my R Markdown files.
- Note: this is a highly controversial topic! We have currently hit a happy medium where I am okay doing this (it gives me the opportunity to more carefully review the changes I think), and he has allowed me to send drafts without tracked changes back.
- NOT ALL COLLABORATORS WILL BE THIS FLEXIBLE. Some want to see the tracked changes sent back to them too. This gets tricky with R Markdown, and has been the centre of several debates.
- Some semi-solutions you may wish to explore that I have retweeted exactly for this purpose:
Well this is potentially extremely exciting. Two way word <-> rmd street, including tracked changes integration. Will be watching this one 👀 https://t.co/7hcqolbBFQ
— Thea Knowles ((???)) December 2, 2018
TIL There is a way to compare diffs between 2 .docx files
— Thea Knowles ((???)) February 15, 2019
Implications for Rmd workflows with collaborators/supervisors using Word: Use the revised .docx version to guide changes in your .Rmd, then compare new output with the original to dbl check
👍 https://t.co/A2EtEpFxbm pic.twitter.com/dnWDjCXLxn