Data Science Chapter 9

Assignment

Published

October 19, 2026

Address the questions 1-11 and submit to Samba by Tuesday, Oct. 1.

Frequently Used Recipes

For each of the following, choose a dataset of your own (or one used in class) and show the R code that answers the question, along with its output.

  1. Display the first few rows of your dataset so you can see what it looks like.
  2. List the names of all the variables (columns) in your dataset.
  3. Report the number of variables and the number of observations (rows) in your dataset.
  4. For one categorical variable of your choosing, list all of its distinct values.
  5. For one numeric variable of your choosing, report its minimum and maximum values.
  6. Create a subset of your dataset that keeps only the variables and/or rows relevant to a question you want to answer, and explain what the subset contains.

Text Exercises

Complete the following exercise sets from R for Data Science. Show your code and output for each exercise, and answer any written-response questions in full sentences.

  1. Complete the exercises in Section 9.2 - Aesthetics.
  2. Complete the exercises in Section 9.3 - Geoms.
  3. Complete the exercises in Section 9.4 - Facets.

Browse & Report

ggplot2 extensions gallery

  1. Browse the ggplot2 extensions gallery, choose two extensions that interest you, implement an example of each in R, and be prepared to report back to class on why you found them interesting.

tidyverse reference page

  1. Browse the ggplot2 reference page, identify two functions or features you find interesting, and be prepared to report back to class on what they do and why they caught your attention.