Checklist for starting an R session

1 Starting a new project

The following are the steps that you should complete when starting a new project. You might consider printing out this page as a reminder of the steps to take while you are at the beginning of your learning journey.

1.1 Using the tidyverse

We will assume that you load the tidyverse every time you start R Studio — that is, you execute library(tidyverse) in the R Console. If we are going to ask you to use a non-core tidyverse package, then we will tell you to load that library as well.

1.2 Preparing your computer for data

When you are doing any data analysis project, you have to have a place to put the data (we did that above) and tell RStudio where to look for data (which we’ll do now).

1.2.1 Create a new project subdirectory

Any time that you start a new project for learning or work, you should also create a subdirectory within learndata.

Suppose that you are taking a class and you have a project for Week 1. In that case, we recommend that you call it week1; thus, the full directory name is Documents/R/learndata/week1. (Of course, you might also create a folder within learndata for each class or workshop that you take; this is up to you. Your decision will change over time so don’t stress too much about it.)

Within this subdirectory, you will store all of its data, scripts, graphs, and reports.

1.2.2 Create a new RStudio project

After creating the subdirectory, you need to tell RStudio that you are beginning a new project. You do this with the menu choice File/New Project...; when the dialog box comes up, choose Existing Directory and then browse to the directory that you just created.

The wonderful thing about creating this project is that now RStudio knows where to look for data—i.e., where the working directory has been set. The project will also remember which files you have open, so you can jump right back in after closing RStudio and returning to the work later on.

If you want to know what the working directory is for R, then go to the Console and type getwd().

1.3 Download the data where it can be used

After creating the subdirectory and new RStudio project, then download whatever data you are supposed to work with into that directory.

2 Returning to an existing project

After you have gone through all of the pain of starting a new project, subsequent working sessions will be much easier.

Suppose that it is morning, you are ready to face a new day, and it is time for you to return to work on the project. If you are starting up RStudio after working on some other project or with a completely empty RStudio workspace, then simply follow these steps:

  1. Choose File/Recent Projects and choose the name of the project that you want to work on. The projectc will open, the working directory will change, and the files that you most recently were working on will be open.
  2. In the Console, type in library("tidyverse") in order to load that library.

You are now ready to continue working on this project.