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-class
repo and create anR
folder and adata
folder. Within thedata
folder add araw
folder and aclean
folder. Put the.csv
file in thedata/raw
folder and the script inR
folder. 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
. What do you notice?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.Rproj
file in your file browser. You should have a clean environment!
Resources
- Jenny Bryan’s blog post: Project-oriented workflow