5 Notebook Workflow

Dive in feet first and create your first R Notebook.

ADD SECTION: this chapter needs lots of attention.

5.1 Create a New Notebook

5.1.1 YAML header

5.1.2 Plain Text

5.1.3 Code Chunks

5.2 Interact within a Notebook

5.2.1 Run Code Chunks

5.2.2 Chunk Options

5.3 Knit a Notebook

5.3.1 Storing all associated files

If you are using any files, such as datasets or images, they need to be stored in the same folder location as the R Notebook (.Rmd file).

This folder location must be the Working Directory for the R Studio session. If you opened your .Rmd notebook file by double-clicking on its name, then this should be the case.

5.3.2 Setting the working directory

To ensure that R Studio knows where to find the files, you can manually set the Working Directory through the menu:

  • Click Session
  • Select Set Working Directory by hovering your mouse over it
  • Click on To Source File Location

You can double check that you were successful by

  • Click on the Files tab in the many-tab panel
  • Click on the button with the gear that says More
  • Click Go To Working Directory

At this point you should see all the files that reside in the folder location where the open .Rmd files is also saved.

5.3.3 Press Knit