17.6 Collaborate on Rmd documents through Google Drive

Based on the googledrive package (D’Agostino McGowan and Bryan 2020), Emily Kothe provided a few wrapper functions in the rmdrive package, which is currently available only on GitHub at https://github.com/ekothe/rmdrive. At the time of writing, it still lacks rich documentation, so I recommend that you try Janosch Linkersdörfer’s fork instead: https://github.com/januz/rmdrive (which is based on Ben Marwick’s fork—if you still have not learned GIT, you may be motivated by these examples of freely forking and improving other people’s GIT repositories).

The workflow with rmdrive is outlined below:

  1. We assume there is a main author or contributor of the project, who is capable of using version control tools like GIT. The main author writes the initial version of the Rmd document, and uploads it to Google Drive via the upload_rmd() function.

  2. The Rmd document in Google Drive is shared with other collaborators, who can make or suggest changes in Google Document.

  3. The main author can accept suggested changes, and download/preview the Rmd document locally via render_rmd(). Other collaborators can also do this by themselves if they have modified code chunks and want to see the new results.

  4. If satisfied, the main author can commit changes to the GIT repository.

The collaborative editing can be either synchronous or asynchronous in Google Drive. Multiple people can edit the same document at the same time, or wait for other people to finish their editing first.

There is also a function udpate_rmd() in the package, which allows you to edit the Rmd document locally, and upload the local Rmd document to Google Drive. You probably should never want to run this function, because it will completely overwrite the document in Google Drive. The main author may want to warn collaborators about this in advance. Ideally, all collaborators should only edit the document in Google Drive and not locally. It is okay to preview the edited document locally via render_rmd(), though (note that render_rmd() automatically downloads the document before rendering it).

References

D’Agostino McGowan, Lucy, and Jennifer Bryan. 2020. Googledrive: An Interface to Google Drive. https://CRAN.R-project.org/package=googledrive.