Week 5 Lab

Published

October 4, 2023

Introduction

We’ve now seen different aspects of the cycle of data science play out in R. We’ve imported data, manipulated, and transformed it. We’ve visualized it using different kinds of graphical elements. And we’ve explored it from different angles.

At the end of the day, we want to be able to communicate our efforts to others. One major reason is that we want our work to be replicable, and for others to be able to build upon it. Those others will likely include our future selves. So far we’ve learned to use comments as a way to leave notes about what our code is doing, but these are very limited and do not give us much room to emphasize, enumerate, and represent complex ideas and reasoning.

In this lab, we will be learning how to use code notebooks to document our work; specifically, we’ll be using Quarto documents, which come bundled with RStudio. By the end of this lab, you will be able to:

  • Create a Quarto document and change its settings in the header

  • Understand the relationship between the source code and visual elements of the document

  • Modify the look of the text in the document using headers and Rmarkdown

  • Add code chunks and edit their settings to show code, outputs, both, or neither

While we’re doing this, we’ll also take this opportunity to refresh ourselves on some of the things we’ve covered so far, such as creating data, using file systems, and dealing with packages. To begin, I recommend, nay, I implore you to set up a file system, including a folder for storing data.