We start with the basics: understanding how files are stored on your machine.
Why start here?
Most analysis scripts begin with something like:
Each file on your computer has a unique address, and the way to navigate to that address is with a “file path”
File paths can be written as “absolute paths”, i.e. “How to get to this file, starting from your root directory?”
or as “relative paths”, i.e. “How to get to this file from any arbitrary location in the file system?”
~
├── Desktop
├── Documents
├── Downloads
├── Library
├── Movies
├── Music
├── Pictures
├── Public
├── lab-admin
├── research
└── teaching
Consider the following directory structure:
Home/
├── coursework
│ ├── course1
│ ├── course2
│ └── course3
└── research
├── project1
└── project2
You are currently working within the directory ~/research/project1, but you realize it is time to review your notes for Course 2.
What steps do you need to navigate to Course 2 notes? Note that you have to articulate the directions one step at a time.
Consider the following directory structure:
Home/
├── coursework
│ ├── course1
│ ├── course2
│ └── course3
└── research
├── project1
└── project2
You are currently working within the project1 directory, but your collaborator asks about a file related to your Project 3.
You have forgotten the names of all the files in that project. How can you quickly check what’s there?
Consider the following directory structure:
Home/
├── coursework
│ ├── course1
│ ├── course2
│ └── course3
└── research
├── project1
└── project2
You had written a script “cool-analysis.R” for your research Project 2 which you now realize is relevant for the Fall 2025 Reproducible Research course. Assuming you are currently in the Home directory, what command could you use to copy cool-analysis.R from the project2 directory into the f25-repro-res directory?
Consider the following directory structure:
Home/
├── coursework
│ ├── course1
│ ├── course2
│ └── course3
└── research
├── project1
└── project2
You got back 252 fastq sequence files from the first big sequencing run of your dissertation. Congrats! In your excitement, you downloaded and stored these under project3 even though they have to do with Project 1. From within the project1 directory, how could you move all 252 of these files over from project3?
You wouldn’t be able to run this on your computers without mucking around!
In a reproducible analysis context, if you can’t read in the dataset, you probably will give up with the reproduction.
Over the course of your dissertation (and certainly your career), you will deal with many different inter-related projects.
You may even use several different computing systems (e.g. right now, you might have a personal laptop, a lab desktop, and use the LSU HPC. Some time in the future, you may replace your computers or add new machines).
How to maintain an organized system?
RStudio’s Projects feature helps maintain workflows, especially as you accumulate many parallel projects.
Inside an RStudio Project, you will only ever use “Relative” paths
The “starting point” is always the directory in which the RProject file is saved.
.Rproj file, home directory, etc.For any given project, conduct a “project audit” to think through the types of files that this work might entail
e.g. for even a “simple” plant ecology project, you might have text files for project brainstorming/literature reviews, spatial data files for locating field plots, scripts for planning experimental/sampling design, flat data files for trait measurements, sequence files, analysis scripts, figures, tables, text files for manuscripts, presentation files, (and likely more).
Your project’s internal structure should be set up to accommodate the complexity of that particular project.
More on this on Thursday
As the previous slide hinted at…
there will be a lot of files!
File naming as a strategy to manage the chaos
Principles for good file names:
. . .
❌ JW7d^(2sl@*.csv
✔️plot1 fire temps 03 Feb 2025.csv
❌ plot 1 fire temps. csv
✔️plot1-fire-temps-3Feb2025.csv
❌ plot1-fire-temps-3Feb2025.csv
✔️ 2025-02-03-plot1-fire-temps.csv