rmdrive
provides convenience functions to copy .Rmd
files to Google
Drive for synchronous collaborative editing, then return them back to a
local .Rmd
file for rendering.
This package is not on CRAN. To install it, please run the following code:
remotes::install_github("januz/rmdrive")
While the functions in this package can accommodate different workflows, it has been designed with the following workflow in mind:
- The main contributor to a data science project (the first author in an academic context) develops the analysis code and writes a first draft of the manuscript associated with the project on their local computer using, e.g., RStudio.
- When the project reaches a state in which the main contributor would
like to facilitate feedback from other contributors to the project,
they
- share the project by giving contributors access to the associated Git repository.
- upload the fist draft of the manuscript to a shared Google Drive
document using
rmdrive::upload_rmd()
.
- All contributors review and edit the manuscript draft by using ‘Suggesting’ mode and comments in Google Drive
- If contributors would like to render a version of the manuscript
including their suggestions, they
- temporarily accept all suggestions.
- use
rmdrive::render_rmd()
to render the changed script manuscript locally. - use
Undo
in Google Drive to show changes as suggestions again.
- After all contributors have finished their review, the main
contributor resolves all comments and accepts/rejects suggestions in
Google Drive, using
rmdrive::render_rmd()
intermittently to render the changed manuscript locally. - The main contributor downloads the final manuscript containing all
changes using
rmdrive::download_rmd()
and commits it to the Git repository. - If, at a later point, the main contributor adds more substantive
changes to the manuscript and would like the contributors to review
the manuscript again, they can upload the newest local version to
the same Google Drive document used before using
rmdrive::update_rmd()
and go through the above steps again.
The package has 4 main functions:
upload_rmd()
uploads a local.Rmd
file to Google Driveupdate_rmd()
uploads a local.Rmd
file to an already existing file in Google Drivedownload_rmd()
downloads a file from Google Drive and saves it as a local.Rmd
file if its content has changedrender_rmd()
executesdownload_rmd()
and renders the resulting.Rmd
file usingrmarkdown::render()
All functions have the same four arguments to specify which local .Rmd
file and Google Drives file to operate on (demonstrated here with
upload_rmd()
:
rmdrive::upload_rmd(
file = "path/to/local-rmd-file" # specifies the local `.Rmd` file (without extension)
gfile = "google-drive-file" # specifies the name of the file on Google Drive (optional; defaults to `basename(file)`)
path = "folder/sub-folder" # specifies a folder in Google Drive (optional; if not specified, the home directory of My Drive or the Team Drive is used)
team_drive = "Team Drive Name" # specifies the name of Team Drive (optional; if not specified, My Drive is used)
)