1.3 R projects and file management
Open the slides in a new tab here.
Exercises
In your computer file browser, find your
epi590r-in-classrepo and create anRfolder and adatafolder. Within thedatafolder add arawfolder and acleanfolder. Put the.csvfile in thedata/rawfolder and the script inRfolder. Your file structure should look like this:epi590r-in-class/ ├─ epi590r-in-class.Rproj ├─ README.md ├─ R/ │ └─ clean-data-bad.R ├─ data/ │ ├─ raw/ │ │ └─ nlsy.csv │ └─ clean/Return to RStudio. Look to the filepane to confirm the files are there.
Look at your Git pane. What do you notice? Stage, commit, and push the changes you’ve made.
Try to run the code, line-by-line, in
clean-data-bad.R. Can you spot various problems that could be revised to improve the code? (If you want to try to fix them you can, but we’ll go over it!)Go to Tools > Global Options and under General, change your settings so that they match these:

Close RStudio. Open it up again by opening the
epi590r-in-class.Rprojfile in your file browser. You should have a clean environment!

Resources
- Jenny Bryan’s blog post: Project-oriented workflow