Reproducibility for the Rest of Us
Managing Project Files for Reproducibility
This lesson is called Managing Project Files for Reproducibility, part of the Reproducibility for the Rest of Us course. This lesson is called Managing Project Files for Reproducibility, part of the Reproducibility for the Rest of Us course.
Transcript
Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.
Learn More
Have any questions? Put them below and we will help you out!
Course Content
12 Lessons
1
Welcome to Reproducibility for the Rest of Us
05:07
2
Reproducibility for the Rest of Us Course Logistics
03:23
3
Using Space Wisely
05:50
4
Naming All the Things
11:19
5
Using Function Arguments
13:06
6
Prologs & Annotation
15:22
7
Using Seed Values
04:46
8
Writing Functions for Repeated Tasks
03:22
9
Literate Programming with Quarto
48:35
10
Embedding Files to Improve Reproducibility
05:38
11
Managing Project Files for Reproducibility
08:55
12
Wrapping Up Reproducibility for the Rest of Us
You need to be signed-in to comment on this post. Login.
Emma S • October 19, 2023
What is the advantage of using "here" instead of just typing the subfolder name in the path? Isn't it hard-coded either way so it would be the same amount of work to update if the files got moved around or folders got renamed?
As in, why in this example is it preferable to put: globalData2019 <- read_spss(here("globaldata","Pew Research Center Global Attitudes Spring 2019 Dataset WEB.sav"))
instead of: globalData2019 <- read_spss("globaldata/Pew Research Center Global Attitudes Spring 2019 Dataset WEB.sav")
?
David Keyes Founder • October 20, 2023
Please see Jenine's answer below. In addition, this article by Malcolm Barrett gives some idea about why you might want to use here even when working in an RStudio project.
I will also say that I tend to use it when working in projects with both Quarto/RMarkdown documents and R script files. That's because the working directory of Quarto/RMarkdown documents is wherever they are located while for R script files it is the root of the project. The
here
package can help ensure that code works identically in either type of file.Jenine Harris • October 20, 2023
The here package helps to avoid problems with working directories when collaborating. If your collaborator has the working directory manually set (or defaulted) to somewhere other than the top folder of the project, the second version you posted would not work for them. In many cases, the second will work just fine and is less typing, for sure, but then you'll get one collaborator with a stubborn installation or a habit of using setwd() at the start of their workflow and there will be trouble. Using R Project files also helps to avoid problems with working directories. Here is a nice description of this issue: https://www.tidyverse.org/blog/2017/12/workflow-vs-script/
At the very least, you'll avoid Jenny Bryan setting your computer on fire.
Thanks for the great question!