If you are using R for more than one thing (a class, thesis, multiple research projects) then I strongly recommend using R projects.
R projects are a great way of keeping all files for one project all together, and makes importing data much easier by using relative paths instead of absolute ones. Plus this ensures reproducibility by others (because noone else has a path at
- Click on the R cube icon in the top right corner of the RStudio program and select Crete new project.
- If you already have a project folder created then choose an “Existing Directory”, otherwise choose a “New directory” and navigate to the folder where this work should belong.
- I recommend checking Open in new session for all projects. This allows you to have multiple Rstudio windows open for different projects and the files/data/objects don’t get cross-contaminated.
Using R Projects
- Navigate in your file explorer to the folder where you created your project.
- Click on the R cube icon to open the whole project.
- Then from your bottom left pane, in the
filestab you can open the desired script files.
Other helpful articles.