Defensive R Programming
Dr. Colin Gillespie
Jumping Rivers
All R analyses start with a little code, but then
Every project I work on
The directory name gives the context of the scripts

This directory contains data, typically
csv & excel filesData is only edited in R

All R code lives in this directory
Notice The directory isn't
just plain R/

In this directory, I always have a file called
load.RThis file loads the data from input/
Every project I've worked has a similar structure

All paths are relative
battles <- read_csv("input/battles.csv")
foes <- read_xlsx("input/foes.xlsx")
My code is portable

Remember, all R files live in the R directory!
clean.R - for cleaning your datafunction.R - any helper functionsanalysis.R - the actual analysisStandard names used in every project
Defensive R Programming