├── .gitignore ├── 00 README First!.txt ├── Benefits of petting dogs.Rmd ├── Benefits-of-petting-dogs.docx ├── Benefits-of-petting-dogs_files ├── .DS_Store └── figure-docx │ ├── conditions-1.pdf │ ├── conditions-1.png │ ├── dog plot-1.pdf │ ├── dog plot-1.png │ ├── dog-plot-1.pdf │ ├── dog-plot-1.png │ ├── histA-1.pdf │ ├── histA-1.png │ ├── histB-1.pdf │ └── histB-1.png ├── Collaborative-reproducible-demo.Rproj ├── LICENSE ├── README.md ├── images ├── Dog-catalogue.jpg └── University-of-Lancashire-Guide-Dogs.jpg └── r-references.bib /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | -------------------------------------------------------------------------------- /00 README First!.txt: -------------------------------------------------------------------------------- 1 | Collaborative code and manuscript writing 2 | 3 | 4 | The manuscript draft in this folder contains two documents (Google Doc - edit, Word Docx - read-only) 5 | * Benefits of petting dogsEdit this one 6 | * Benefits of petting dogs-outputREAD ONLY 7 | 8 | 9 | 10 | 11 | Google doc:Benefits of petting dogs Edit this one (but see below) 12 | * Is a rendered version of an .Rmd generated by the `Papaja` package for APA formatted manuscripts that include R code and analyses (vignette) 13 | * Has been rendered from .Rmd format to Google Doc format by the `Trackdown` package (See package vignette Collaborative Editing of Rmd (or Quarto / Rnw) Documents in Google Drive • trackdown) 14 | * “The trackdown package offers a simple solution for collaborative writing and editing of R Markdown documents. Using trackdown, the local .Rmd file can be uploaded as a plain-text file to Google Drive. By taking advantage of the easily readable Markdown syntax and the well-known online interface offered by Google Docs, collaborators can easily contribute to the writing and editing process. After integrating all authors’ contributions, the final document can be downloaded and rendered locally.” 15 | * Contains plain text that can be collaboratively edited using Google doc track changes, version control and comments features. 16 | * Contains properly formatted Markdown syntax and R code that should not be edited in the Google Doc. Please do not edit or remove placeholders of type "[[chunk-]]" or "[[document-header]]" 17 | * Please see package vignette for more information 18 | * Please edit any R code within the source .Rmd. The latest version of the .Rmd can be found in the Github repository for the project. In order to make edits, please fork and clone the project, and then make a pull request with changes. Do not edit the file directly, or within Github. Further links on using Github 19 | 20 | 21 | Word docx: Benefits of petting dogs-outputREAD ONLY 22 | * Is a ‘knit’ version of the .Rmd that generated the Google Doc 23 | * Is included only to show formatting, and output of code chunks, including in-text statistics, and plots 24 | * NB: any edits to the Word Doc will not be incorporated into the .Rmd that generates the final manuscript. Please make any text changes to the Google Doc -------------------------------------------------------------------------------- /Benefits of petting dogs.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title : "An examination of the benefits of petting dogs before exams" 3 | shorttitle : "Benefits of petting dogs before exams" 4 | 5 | author: 6 | - name : "Cylcia Bolibaugh" 7 | affiliation : "1" 8 | corresponding : yes # Define only one corresponding author 9 | address : "University of York, UK" 10 | email : "my@email.com" 11 | role: # Contributorship roles (e.g., CRediT, https://casrai.org/credit/) 12 | - Conceptualization 13 | - Writing - Original Draft Preparation 14 | - Writing - Review & Editing 15 | 16 | affiliation: 17 | - id : "1" 18 | institution : "University of York" 19 | 20 | authornote: | 21 | Add complete departmental affiliations for each author here. Each new line herein must be indented, like this line. 22 | 23 | Enter author note here. 24 | 25 | abstract: | 26 | This is an example manuscript used to demonstrate a reproducible, collaborative workflow using RMarkdown, Github, and the Papaja and trackdown packages. 27 | 28 | 29 | 30 | 31 | 32 | keywords : "reproducible manuscripts, collaborative workflow" 33 | wordcount : "X" 34 | 35 | bibliography : ["r-references.bib"] 36 | 37 | floatsintext : no 38 | figurelist : no 39 | tablelist : no 40 | footnotelist : no 41 | linenumbers : yes 42 | mask : no 43 | draft : no 44 | 45 | documentclass : "apa6" 46 | classoption : "jou" 47 | output : papaja::apa6_docx 48 | --- 49 | 50 | ```{r setup, include = FALSE} 51 | library(cowplot) 52 | library("papaja") 53 | library(ggplot2) 54 | r_refs("r-references.bib") 55 | ``` 56 | 57 | ```{r analysis-preferences} 58 | # Seed for random number generation 59 | set.seed(42) 60 | knitr::opts_chunk$set(cache.extra = knitr::rand_seed) 61 | ``` 62 | A recent study suggested that spending time with a pet acts as a buffer against psychological stress (Ratschen et al., 2020). Imagine that we conducted an experiment to explore whether this effect generalised to stress caused by university exams. Specifically, we hypothesised that students who spent time with a university health and wellbeing dog before an exam would have fewer feelings of stress relative to students who only looked at pictures of dogs before an exam. 63 | 64 | In order to test the hypothesis we recruited 200 students who had imminent exams and self-reported that they felt stressed, and assigned half of them to pet the university dog, and half to look through a catalogue of dog pictures. We then assessed how stressed they felt on the Stress-o-metre Scale (1-100). 65 | 66 | # Methods 67 | 68 | ## Participants 69 | We recruited two hundred undergraduate students. All students were screened to ensure that they planned to sit an exam within the next 5 days, and that they reported feeling stressed. 70 | 71 | ## Material 72 | We randomly assigned half of the participants to pet the university dog, and half to look through a catalogue of dog pictures. We then assessed how stressed they felt on the Stress-o-metre Scale (1-100). 73 | 74 | 75 | 76 | ```{r dog_images, echo=FALSE} 77 | 78 | # create inline figures with 2 images 79 | live_dog <- ggdraw() + 80 | draw_image("University-of-Lancashire-Guide-Dogs.jpg", width = .66) 81 | 82 | book_dog <- ggdraw() + draw_image("Dog-catalogue.jpg") 83 | 84 | conditions <- plot_grid(live_dog, book_dog, ncol = 2, labels = c("Live dog", "Dog pictures"), label_y = .2) 85 | 86 | ``` 87 | ```{r conditions, echo=FALSE, fig.cap = "This is a test"} 88 | # print figure 89 | conditions 90 | ``` 91 | 92 | ## Procedure 93 | Our imaginary students were randomly assigned into the "Live Dog" condition or the "Dog Pictures" condition. Each participant sat the intervention and test individually. They spent 5 minutes either petting the dog, or looking at dog pictures. They then completed the Stress-o-Metre self-assessment in a quiet room. 94 | 95 | ## Data analysis 96 | The distribution of scores of the Stress-o-Metre scale from the "Live Dog" and "Dog Pictures" groups are depicted in Figures 2 and 3 below. The reliability of the Stress-0-metre Scale has not been established. 97 | 98 | 99 | 100 | ```{r ind-vars, echo=FALSE} 101 | ## (For the purposes of this simulation, we have a simple between subjects design, where the independent (grouping) variable has two levels, and the dependent variable is from a normal distribution.) ## 102 | 103 | # Simulate normally distributed data for an independent samples t-test 104 | muA <- 50 #what's the population mean for condition A? 105 | muB <- 55 #what's the population mean for condition B? 106 | 107 | n1 <- 100 #how many participants group A? 108 | n2 <- 100 #how many participants group B? 109 | 110 | sigma1 <- 20 #population standard deviation of condition A? 111 | sigma2 <- 20 #population standard deviation of condition B? 112 | ``` 113 | 114 | ```{r ind-dat, echo=FALSE} 115 | # Generate the scores using the `rnorm()` function, then plot the distribution of scores for each group. 116 | 117 | A_scores <- rnorm(n1,muA,sigma1) #simulate a vector of 100 deviates from normal distribution 118 | B_scores <- rnorm(n2,muB,sigma2) #simulate a vector of 100 deviates from normal distribution 119 | ``` 120 | 121 | ```{r histA, fig.cap = "Distribution of scores from Live dog condition"} 122 | hist(A_scores, main = "Live Dog condition", xlab = "Stress-O-Metre scores") 123 | ``` 124 | 125 | 126 | 127 | 128 | ```{r histB, fig.cap = "Distribution of scores from Dog pictures condition"} 129 | hist(B_scores, main = "Dog Pictures condition", xlab = "Stress-O-Metre scores") 130 | ``` 131 | 132 | [[chunk-wide dog]] 133 | 134 | [[chunk-long dog]] 135 | 136 | We used `r cite_r("r-references.bib")` for all our analyses. 137 | 138 | # Results 139 | 140 | 141 | 142 | ```{r t-test1, eval=FALSE, include=FALSE} 143 | # I can now run my inferential test on my new data. 144 | t.test(A_scores,B_scores) 145 | ``` 146 | 147 | ```{r t-test2} 148 | # We want to report the results from the statistical test in an inline report (i.e. a sentence), so we assign it to an object and extract the parameters we need in text: 149 | 150 | mod1 <- broom::tidy(t.test(A_scores,B_scores)) 151 | ``` 152 | 153 | ```{r track-uoload, eval=FALSE, include=FALSE} 154 | # trackdown package to create google doc for collaboration 155 | 156 | trackdown::upload_file( 157 | file = "Benefits of petting dogs.Rmd", 158 | gfile = NULL, 159 | gpath = "trackdown/Demo", 160 | shared_drive = NULL, 161 | hide_code = TRUE, 162 | path_output = "Benefits-of-petting-dogs.docx" 163 | ) 164 | ``` 165 | A `r mod1$method` indicated that participants who pet dogs (*M* = `r round(mean(A_scores),2)`, *SD* = `r round(sd(A_scores),2)`) did [not] score significantly lower than participants who looked at pictures of dogs (*M* = `r round(mean(B_scores),2)`, *SD* = `r round(sd(B_scores),2)`), *t*(`r round(mod1$parameter,2)`) = `r round(mod1$statistic,2)`, *p* = `r round(mod1$p.value,2)` on the Stress-O-Metre Scale. 166 | 167 | These results can be seen in Figure 4. 168 | 169 | [[chunk-dog-plot]] 170 | 171 | # Discussion 172 | 173 | This is a poorly designed study with multiple confounds. In future research, the materials and intervention will need to be validated, and the Stress-O-Metre’s reliability established. The design would benefit from a pre-test as well. 174 | 175 | \newpage 176 | 177 | # References 178 | 179 | \begingroup 180 | \setlength{\parindent}{-0.5in} 181 | \setlength{\leftskip}{0.5in} 182 | 183 |
184 | \endgroup 185 | 186 | [[chunk-track-upload]] 187 | ```{r track-update, eval=FALSE, include=FALSE} 188 | # trackdown package to create google doc for collaboration 189 | 190 | update_file( 191 | file = "Benefits of petting dogs.Rmd", 192 | gfile = NULL, 193 | gpath = "trackdown", 194 | shared_drive = NULL, 195 | hide_code = TRUE, 196 | path_output = "Benefits-of-petting-dogs.docx" 197 | ) 198 | ``` 199 | ```{r track-down, eval=FALSE, include=FALSE} 200 | trackdown::download_file( 201 | file = "Benefits of petting dogs.Rmd", 202 | gfile = NULL, 203 | gpath = "trackdown", 204 | shared_drive = NULL) 205 | 206 | ``` 207 | -------------------------------------------------------------------------------- /Benefits-of-petting-dogs.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CBolibaugh/Collaborative-reproducible-demo/8df9baff9fdc28f12c534e5cd067ab51f78d8e0f/Benefits-of-petting-dogs.docx -------------------------------------------------------------------------------- /Benefits-of-petting-dogs_files/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CBolibaugh/Collaborative-reproducible-demo/8df9baff9fdc28f12c534e5cd067ab51f78d8e0f/Benefits-of-petting-dogs_files/.DS_Store -------------------------------------------------------------------------------- /Benefits-of-petting-dogs_files/figure-docx/conditions-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CBolibaugh/Collaborative-reproducible-demo/8df9baff9fdc28f12c534e5cd067ab51f78d8e0f/Benefits-of-petting-dogs_files/figure-docx/conditions-1.pdf -------------------------------------------------------------------------------- /Benefits-of-petting-dogs_files/figure-docx/conditions-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CBolibaugh/Collaborative-reproducible-demo/8df9baff9fdc28f12c534e5cd067ab51f78d8e0f/Benefits-of-petting-dogs_files/figure-docx/conditions-1.png -------------------------------------------------------------------------------- /Benefits-of-petting-dogs_files/figure-docx/dog plot-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CBolibaugh/Collaborative-reproducible-demo/8df9baff9fdc28f12c534e5cd067ab51f78d8e0f/Benefits-of-petting-dogs_files/figure-docx/dog plot-1.pdf -------------------------------------------------------------------------------- /Benefits-of-petting-dogs_files/figure-docx/dog plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CBolibaugh/Collaborative-reproducible-demo/8df9baff9fdc28f12c534e5cd067ab51f78d8e0f/Benefits-of-petting-dogs_files/figure-docx/dog plot-1.png -------------------------------------------------------------------------------- /Benefits-of-petting-dogs_files/figure-docx/dog-plot-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CBolibaugh/Collaborative-reproducible-demo/8df9baff9fdc28f12c534e5cd067ab51f78d8e0f/Benefits-of-petting-dogs_files/figure-docx/dog-plot-1.pdf -------------------------------------------------------------------------------- /Benefits-of-petting-dogs_files/figure-docx/dog-plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CBolibaugh/Collaborative-reproducible-demo/8df9baff9fdc28f12c534e5cd067ab51f78d8e0f/Benefits-of-petting-dogs_files/figure-docx/dog-plot-1.png -------------------------------------------------------------------------------- /Benefits-of-petting-dogs_files/figure-docx/histA-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CBolibaugh/Collaborative-reproducible-demo/8df9baff9fdc28f12c534e5cd067ab51f78d8e0f/Benefits-of-petting-dogs_files/figure-docx/histA-1.pdf -------------------------------------------------------------------------------- /Benefits-of-petting-dogs_files/figure-docx/histA-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CBolibaugh/Collaborative-reproducible-demo/8df9baff9fdc28f12c534e5cd067ab51f78d8e0f/Benefits-of-petting-dogs_files/figure-docx/histA-1.png -------------------------------------------------------------------------------- /Benefits-of-petting-dogs_files/figure-docx/histB-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CBolibaugh/Collaborative-reproducible-demo/8df9baff9fdc28f12c534e5cd067ab51f78d8e0f/Benefits-of-petting-dogs_files/figure-docx/histB-1.pdf -------------------------------------------------------------------------------- /Benefits-of-petting-dogs_files/figure-docx/histB-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CBolibaugh/Collaborative-reproducible-demo/8df9baff9fdc28f12c534e5cd067ab51f78d8e0f/Benefits-of-petting-dogs_files/figure-docx/histB-1.png -------------------------------------------------------------------------------- /Collaborative-reproducible-demo.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Cylcia Bolibaugh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Reproducible *and Collaborative* Workflows 3 | 4 | This repo is for you if you are interested in using Rmarkdown, and the Papaja template to draft APA formatted manuscripts and you don't work alone! Unfortunately Rmarkdown documents are not great for writing collaboratively. Rmds can be used to generate Word documents, but then you may be stuck emailing these Word docs between collaborators (with file names that grow as different co-authors edit them). You might choose to convert your Word documents to Google docs, which is great because you can now write collaboratively and make use of the built-in version control and track-changes features instead of emailing, but in either case you will still have a problem: after everyone has finished editing the text, you will need to manually re-integrate the changes into the local copy of your Rmd formatted manuscript. I do not enjoy doing this. The process can be particularly finicky when carrying out small changes throughout a manuscript (e.g. as can happen during rounds of review & resubmit). 5 | 6 | One solution to this re-integration problem is to use Git and a service like Github to manage changes. I'm sure this works well in some teams. My own experience is that most of my collaborators don't use Git(hub) and onboarding unwilling collaborators is not worth the pain. I also suspect that for most researchers with low to intermediate GIT skill levels (me!), Git is good for managing code, but not optimised for text. 7 | 8 | Another solution is the [`Trackdown` package](https://github.com/ClaudioZandonella/trackdown) package. After a brief detour into why you might want to use Rmarkdown (or Quarto) I then describe my usual workflow with the package, illustrating with a dummy manuscript. 9 | 10 | ### A quick sidestep: Why Rmarkdown? 11 | 12 | Rmarkdown (& quarto) are great for creating dynamic manuscripts. Dynamic manuscripts combine code, the output of that code, and narrative writing all in one file. In a dynamic document, the code is executed within the document in real time and it produces "living" figures, tables, models, etc. that are updated any time the code itself or the underlying data is updated. Because of this, dynamic documents are also reproducible. 13 | 14 | The [`Papaja`](https://github.com/crsh/papaja) package is an R package that provides document formats to produce complete APA manuscripts from RMarkdown-files (PDF and Word documents) and helper functions that facilitate reporting statistics, tables, and plots. 15 | 16 | In this repository, I document the steps for creating a new project repository, cloning and pushing code changes to Github, and then using the `Trackdown` package to separately create a Google Doc from an RMarkdown file that is used for collaborative narrative work. I am using the `Papaja` package to generate an APA formatted manuscript. 17 | 18 | ### An example of a typical workflow with a dummy manuscript 19 | 20 | This workflow assumes that you use Github, but it's not necessary to do so in order to use Trackdown. If you want to simply work on your local R projects, and then collaborate on the text portions of the manuscripts, you can pick up the Workflow in Step 3. 21 | 22 | 1. Create a new project repository in Github 23 | 24 | 2. Start a new RStudio project locally by cloning the repository, and create the needed directory structure (e.g. folders for raw data, processed data, manuscript etc.) 25 | 26 | 3. Work locally in your project. For this example, I have created a dummy report of a study that uses simulated data in a new rmarkdown file (using the Papaja template). On a "real" project, I would usually start by writing a processing script that outputs cleaned and ready-to-analyse data to the processed data folder, and then (for simple analyses) carry out my analyses within the Papaja generated manuscript. 27 | 28 | 4. Once ready to share with collaborators, I use the `trackdown` package to upload my Rmarkdown files to Google drive. (Note that I often do this even if I am the only one writing as I prefer to draft text in Docs. If using Github, make sure to push changes before upload to Drive.) 29 | 30 | 5. Install the `trackdown` package from CRAN and use the `upload_file()` function to create a Google doc in your Google Drive from the present Rmarkdown file. 31 | 32 | > trackdown::upload_file(file = "Path-to-file/My-Report.Rmd", hide_code = TRUE) 33 | 34 | Here I have chosen to hide the code so that collaborators don't accidentally overwrite anything they don't understand when we are creating the narrative portion of the text, but I can imagine circumstances (e.g. working with my own PhDs) where I wouldn't want to do this, and specified 35 | 36 | 6. The first time you do this, you will have to authenticate your credentials. The message appears in your console, so check, or nothing will happen. 37 | 38 | > Is it OK to cache OAuth access credentials in the folder\~/Library/Caches/gargle between R sessions? 39 | > 40 | > 1: Yes 41 | > 42 | > 2: No 43 | 44 | 7. Once you've accepted you'll need to navigate to the Google folder you've set as the destination, and you can start working on the Google doc. 45 | 46 | An important point to note is that any changes made to the document in Suggestion Mode, and any comments, need to be accepted before the document is reconciled with the local .Rmd. 47 | 48 | 8. Once ready to reconcile the new text with your local .Rmd, run the `download_file()` function from your R session. 49 | 50 | > `trackdown::download_file(file = "Path-to-file/My-Report.Rmd")` 51 | 52 | After running this in the console, you are duly warned that downloading will overwrite your local file, and have to confirm that you want to do this. Once you agree you are prompted to reload your file and ta-da, the text you (& your collaborators) wrote in Google Docs is now in your local .Rmd document. 53 | 54 | For future iterations of this workflow, make sure to use the `update_file()` command instead of `upload_file()`. 55 | 56 | #### A few tips for collaborating in Google Docs 57 | 58 | 1. Make use of the `path output` parameter in the `upload-file()` and`update_file()` functions to upload the rendered and formatted Word document as well as the google doc version of the markdown formatted manuscript. This will enable collaborators to read through the document with figures, and in-line output in place. (Make sure you have knit immediately before uploading!) 59 | 60 | 2. When sharing with collaborators on Google Drive, do not share the whole project folder content with the same permissions. Instead, share the output Word doc as "read only" to ensure that edits do not happen here, and share the Google Doc version of the Rmd with editing permissions. 61 | 62 | 3. Set `hide_code = TRUE` in the `upload-file()` and`update_file()` functions if you are working with collaborators who are not code-savvy. This is probably good practice in all cases because anyone reviewing the code should be working from the Github repo, and the Google Drive uploads should be for text edits only. 63 | 64 | 4. If there is a lot of data processing in the Rmd, the number of "hidden" code chunks in the Google Doc can start to be visually disorienting. Here a better practice is likely to be creating separate .Rmd or .R files for analyses that are sourced in the main Papaja .Rmd. 65 | 66 | 5. Think about how to initiate collaborators to this way of working. I use a brief onboarding document that re-iterates the text `Trackdown` places at the start of the Google Doc to explain how to interact with it, and run through it with collaborators. I include this in the Google Drive folder with the other two documents. You can see a plain text example above: 00 README First!.txt 67 | 68 | 6. When working with a template like Papaja, include 3 separate chunks to use the `Trackdown` commands at the beginning or end of the manuscript. (I find it easier to keep them at the end.) All of these chunks should be set with options `eval = FALSE` and `include = FALSE` so they are not run when you knit the document. For this demonstration document, I've created the following three chunks (named `track-upload`, `track-update` and `track-download`) that I can run manually as needed: 69 | 70 | ```{r track-upload, eval=FALSE,echo=TRUE} 71 | upload_file(file = "Benefits of petting dogs.Rmd", 72 | gfile = NULL, 73 | gpath = "trackdown", 74 | shared_drive = NULL, 75 | hide_code = TRUE, 76 | path_output = "Benefits-of-petting-dogs.docx" 77 | ) 78 | ``` 79 | 80 | ```{r track-update, eval=FALSE, echo=TRUE} 81 | trackdown::update_file( 82 | file = "Benefits of petting dogs.Rmd", 83 | gfile = NULL, 84 | gpath = "trackdown", 85 | shared_drive = NULL, 86 | hide_code = TRUE, 87 | path_output = "Benefits-of-petting-dogs.docx" 88 | ) 89 | ``` 90 | 91 | ```{r track-down, eval=FALSE, echo=TRUE} 92 | trackdown::download_file( 93 | file = "Benefits of petting dogs.Rmd", 94 | gfile = NULL, 95 | gpath = "trackdown", 96 | shared_drive = NULL) 97 | 98 | 99 | ``` 100 | -------------------------------------------------------------------------------- /images/Dog-catalogue.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CBolibaugh/Collaborative-reproducible-demo/8df9baff9fdc28f12c534e5cd067ab51f78d8e0f/images/Dog-catalogue.jpg -------------------------------------------------------------------------------- /images/University-of-Lancashire-Guide-Dogs.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CBolibaugh/Collaborative-reproducible-demo/8df9baff9fdc28f12c534e5cd067ab51f78d8e0f/images/University-of-Lancashire-Guide-Dogs.jpg -------------------------------------------------------------------------------- /r-references.bib: -------------------------------------------------------------------------------- 1 | @Manual{R-base, 2 | title = {R: A Language and Environment for Statistical Computing}, 3 | author = {{R Core Team}}, 4 | organization = {R Foundation for Statistical Computing}, 5 | address = {Vienna, Austria}, 6 | year = {2020}, 7 | url = {https://www.R-project.org/}, 8 | } 9 | @Manual{R-papaja, 10 | author = {Frederik Aust and Marius Barth}, 11 | title = {{papaja}: {Create} {APA} manuscripts with {R Markdown}}, 12 | year = {2020}, 13 | note = {R package version 0.1.0.9997}, 14 | url = {https://github.com/crsh/papaja}, 15 | } 16 | @Book{R-ggplot2, 17 | author = {Hadley Wickham}, 18 | title = {ggplot2: Elegant Graphics for Data Analysis}, 19 | publisher = {Springer-Verlag New York}, 20 | year = {2016}, 21 | isbn = {978-3-319-24277-4}, 22 | url = {https://ggplot2.tidyverse.org}, 23 | } 24 | @Manual{R-cowplot, 25 | title = {cowplot: Streamlined Plot Theme and Plot Annotations for 'ggplot2'}, 26 | author = {Claus O. Wilke}, 27 | year = {2020}, 28 | note = {R package version 1.1.1}, 29 | url = {https://CRAN.R-project.org/package=cowplot}, 30 | } 31 | @Manual{R-dplyr, 32 | title = {dplyr: A Grammar of Data Manipulation}, 33 | author = {Hadley Wickham and Romain François and Lionel Henry and Kirill Müller}, 34 | year = {2021}, 35 | note = {R package version 1.0.6}, 36 | url = {https://CRAN.R-project.org/package=dplyr}, 37 | } 38 | @Manual{R-forcats, 39 | title = {forcats: Tools for Working with Categorical Variables (Factors)}, 40 | author = {Hadley Wickham}, 41 | year = {2021}, 42 | note = {R package version 0.5.1}, 43 | url = {https://CRAN.R-project.org/package=forcats}, 44 | } 45 | @Manual{R-here, 46 | title = {here: A Simpler Way to Find Your Files}, 47 | author = {Kirill Müller}, 48 | year = {2020}, 49 | note = {R package version 1.0.1}, 50 | url = {https://CRAN.R-project.org/package=here}, 51 | } 52 | @Manual{R-purrr, 53 | title = {purrr: Functional Programming Tools}, 54 | author = {Lionel Henry and Hadley Wickham}, 55 | year = {2020}, 56 | note = {R package version 0.3.4}, 57 | url = {https://CRAN.R-project.org/package=purrr}, 58 | } 59 | @Manual{R-readr, 60 | title = {readr: Read Rectangular Text Data}, 61 | author = {Hadley Wickham and Jim Hester}, 62 | year = {2020}, 63 | note = {R package version 1.4.0}, 64 | url = {https://CRAN.R-project.org/package=readr}, 65 | } 66 | @Manual{R-stringr, 67 | title = {stringr: Simple, Consistent Wrappers for Common String Operations}, 68 | author = {Hadley Wickham}, 69 | year = {2019}, 70 | note = {R package version 1.4.0}, 71 | url = {https://CRAN.R-project.org/package=stringr}, 72 | } 73 | @Manual{R-tibble, 74 | title = {tibble: Simple Data Frames}, 75 | author = {Kirill Müller and Hadley Wickham}, 76 | year = {2021}, 77 | note = {R package version 3.1.2}, 78 | url = {https://CRAN.R-project.org/package=tibble}, 79 | } 80 | @Manual{R-tidyr, 81 | title = {tidyr: Tidy Messy Data}, 82 | author = {Hadley Wickham}, 83 | year = {2021}, 84 | note = {R package version 1.1.3}, 85 | url = {https://CRAN.R-project.org/package=tidyr}, 86 | } 87 | @Article{R-tidyverse, 88 | title = {Welcome to the {tidyverse}}, 89 | author = {Hadley Wickham and Mara Averick and Jennifer Bryan and Winston Chang and Lucy D'Agostino McGowan and Romain François and Garrett Grolemund and Alex Hayes and Lionel Henry and Jim Hester and Max Kuhn and Thomas Lin Pedersen and Evan Miller and Stephan Milton Bache and Kirill Müller and Jeroen Ooms and David Robinson and Dana Paige Seidel and Vitalie Spinu and Kohske Takahashi and Davis Vaughan and Claus Wilke and Kara Woo and Hiroaki Yutani}, 90 | year = {2019}, 91 | journal = {Journal of Open Source Software}, 92 | volume = {4}, 93 | number = {43}, 94 | pages = {1686}, 95 | doi = {10.21105/joss.01686}, 96 | } 97 | @Manual{R-tinylabels, 98 | title = {{tinylabels}: Lightweight Variable Labels}, 99 | author = {Marius Barth}, 100 | year = {2023}, 101 | note = {R package version 0.2.4}, 102 | url = {https://cran.r-project.org/package=tinylabels}, 103 | } 104 | --------------------------------------------------------------------------------