Projects in RStudio
BSTA 511/611
- I highly, highly, HIGHLY recommend using R Projects to organize your analyses and make it easier to load data files and also save output.
- When you create an R Project on your computer, the Project is associated with the folder (directory) you created it in.
- This folder becomes the “root” of your working directory, and RStudio’s point of reference from where to load files from and to.
- I create separate Projects for every analysis project and every class I teach.
- You can run multiple sessions of RStudio by opening different Projects, and the environments (or working directory) of each are working independently of each other.
Note
- Although we are using Quarto files,
- I will show how to set up and use a “regular” R Project
- instead of “Quarto Project”
- Quarto Projects include extra features and thus complexity. Once you are used to how regular R Projects work, you can try out a Quarto Project.
Warning
- Many (if not most) of the resources below refer to RMarkdown instead of Quarto files to create reproducible reports.
- This is not a problem. Projects work the same way with Quarto files.
1 Learn more about Projects and why you should always be using them
Below are various resources to learn more about RStudio Projects.
- RStudio Projects and Working Directories: A Beginner’s Guide
- From R-bloggers website
- TOC
- What is a RStudio Project, and why?
- Easy file path referencing with RStudio Projects
- Structuring your working directory
- Further reading
- Posit’s (RStudio’s) directions on creating Projects
- https://support.rstudio.com/hc/en-us/articles/200526207-Using-RStudio-Projects
- This page provides concise directions, but not much motivation on why you should be using Projects.
- R for Data Science
- Excellent book R for Data Science (2nd edition) by Hadley Wickham, Mine Çetinkaya-Rundel, and Garrett Grolemund
- See Chapter 6 Section 2: Projects (https://r4ds.hadley.nz/workflow-scripts#projects) for
- Jenny Bryant’s STAT 545 class notes
- Check out Chapter 2 R basics and workflows https://stat545.com/r-basics.html
- Section 2.2: Workspace and working directory
- Section 2.3: RStudio Projects
2 YouTube videos on how to create an R Project
This video demonstrates how to create an R Project, and how to open RStudio using the Project file.
- The Basics of Projects in RStudio by Sam Burer
https://www.youtube.com/watch?v=hKoSJGWnFFA - Introduction to RStudio Projects by Michael Seaman https://www.youtube.com/watch?v=wqOme7xsZvs