
---
title: "Problem Set 04"
author: "WRITE YOUR NAME HERE"
date: "2021-09-18"
output:
  pdf_document:
    toc: no
  html_document:
    highlight: tango
    theme: cosmo
    toc: yes
    toc_depth: 2
    toc_float:
      collapsed: no
    df_print: kable
---

```{r, include=FALSE}
# Do not edit this code block/chunk
knitr::opts_chunk$set(echo = TRUE, message=FALSE, warning = FALSE, fig.width = 16/2, fig.height = 9/2)
```

# Learning goals

* Using more data visualization techniques: changing colors and adding trend lines
* Baby's first data wrangling exercise!


# Setup

Load necessary packages:

```{r}
library(ggplot2)
library(dplyr)
library(babynames)
```



# Question 1: Honor code

For this problem set I worked with (please indicate even if with no one):


# Question 2

In this exercise, you're going to recreate the figure from Practice Midterm I Question 4 (see `#midterms` channel in Slack), allowing us to visualize the extent to which the names "Casey" and "Riley" were used for babies of both sex male and female.

## Part a)

Perform the data wrangling necessary to transform the `babynames` data frame included in the `babynames` package into a new data frame called `babynames_riley_casey` that will allow us to create the visualization.

**Hint**: I recommend you first draw on a piece of paper what the data frame should look like; that way you'll know what your target looks like and when you've hit it.

```{r}

```

## Part b)

Recreate the visualization from Practice Midterm I Question 4 *exactly* including the capitalization of all label text.

```{r}

```

## Part c)

Once again, recreate the visualization from Practice Midterm I Question 4 *exactly*, however this time add an appropriately chosen trend lines. For clarity's sake, do NOT include the standard error bars. 

```{r}

```



***



# Bonus

In this exercise, you're going to recreate the figure from Practice Midterm I Question 4 (see `#midterms` channel in Slack). This time however, you're going to limit it to years 1960 and later:

## Part a)

Perform the data wrangling necessary to transform the `babynames` data frame included in the `babynames` package into a new data frame `babynames_riley_casey_1960_later` that only has data for 1960 or later.


```{r}

```

## Part b)

Create the same version of the visualization as in Q2.b), but for the `babynames_riley_casey_1960_later` data frame and with `"forestgreen"` and `"orange"` lines for male and female respectively. This time, the x-axis should only be for years 1960 and later, as saved in the `babynames_riley_casey_1960_later` data frame.

```{r}

```

