Now that we have our folder setup, lets move into R studio and create our project.
In R, a project file stores your current Rstudio working environment in a file within your file system. This means, if you finish your work for the day halfway through an analysis, you can open up your project file the next day and continue straight from where you left off. The other major benefit is that a project file sets your default working directory. This means, when you need to open a file, you only need to do so from the place of your project file. This will make sense in a moment.
To create a project, click file > new project and select existing directory
Then, browse to your new file system we just created and save the project into the base/root of that directory.
The real advantage to using project files is simplifying file opening and saving. We will cover this in more detail in the next page, but essentially, when reading data into R we normally have to specify the entire filepath
surveydata <- read.csv("C:/Users/Mitch/Documents/surveydata.csv")
or, set a working directory
setwd("C:/Users/Mitch/Documents") surveydata <- read.csv("surveydata.csv")
The creation of a project cuts out this step by setting our working directory. This means, anytime we want to open a file, we just need to specify the folders within our project directory. So using our new filing system, we would just need to specify the following:
surveydata <- read.csv("Data/surveydata.csv")
If you have multiple projects, or want to close the current one, simply click the project name in the top right of R studio