Skip to content

Commit

Permalink
day 16 babynames
Browse files Browse the repository at this point in the history
  • Loading branch information
Nics-Github committed Oct 9, 2024
1 parent 67a5250 commit 4a59c9e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 22 deletions.
21 changes: 14 additions & 7 deletions course-materials/in-class-activies/Wrangling_Baby_Names.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,44 @@ We will work with the five verbs to wrangle and graph babynames.

You should check out the [dplyr cheatsheet](https://nics-github.github.io/SDS192/Resources.html).

There are three parts to today's classwork.
There are three parts to today's classwork.

- Part 1. make a narcissistic graph
- Part 1. make a narcissistic graph.

- Part 2. 5 most popular names in the US since 1880

- Part 3. Do presidents' names influence babies' names?
- Part 3. Do presidents' names influence babies' names?

- Part 4. Most and least most popular names.

# Part 1 make a narcissistic graph

## 1. Wrangle your name out of babynames

You will want to `filter()` your name. I would make a vector of names c("Nic","Nicholas", "Nick")

Consider if you want both the sex= M and F.
- In what year was your name the most popular?

## 2. Create a line graph
- Facet by sex.

## 2. Create a line graph

Show the proportion of children with the same names as you over time.

# Part 2. 5 most popular names in the US since 1880

Do some wrangling to tell me the five most popular names separated by sex.

# Part 3. Do presidents' names influence babies' names?
# Part 3. Do presidents' names influence babies' names?

Wrangle the data to show how president's first names effect newborn babies' names. [Former Presidents](https://www.whitehouse.gov/about-the-white-house/presidents/)

- Choose three recent presidents (Donald Trump and Joe Biden might be too recent).
- Choose three recent presidents (Donald Trump and Joe Biden might be too recent).

- Make one graph that shows all three president's names. Use `geom_vline()` to show the year they entered office.

# Part 4: Most and least.

What is the year in which the most babies were born?

What is the year the least babies were born?
13 changes: 11 additions & 2 deletions docs/course-materials/in-class-activies/Wrangling_Baby_Names.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,21 @@ <h2 class="anchored" data-anchor-id="this-is-not-a-lab">This is not a lab</h2>
<p>You should check out the <a href="https://nics-github.github.io/SDS192/Resources.html">dplyr cheatsheet</a>.</p>
<p>There are three parts to today’s classwork.</p>
<ul>
<li><p>Part 1. make a narcissistic graph</p></li>
<li><p>Part 1. make a narcissistic graph.</p></li>
<li><p>Part 2. 5 most popular names in the US since 1880</p></li>
<li><p>Part 3. Do presidents’ names influence babies’ names?</p></li>
<li><p>Part 4. Most and least most popular names.</p></li>
</ul>
</section>
<section id="part-1-make-a-narcissistic-graph" class="level1">
<h1>Part 1 make a narcissistic graph</h1>
<section id="wrangle-your-name-out-of-babynames" class="level2">
<h2 class="anchored" data-anchor-id="wrangle-your-name-out-of-babynames">1. Wrangle your name out of babynames</h2>
<p>You will want to <code>filter()</code> your name. I would make a vector of names c(“Nic”,“Nicholas”, “Nick”)</p>
<p>Consider if you want both the sex= M and F.</p>
<ul>
<li><p>In what year was your name the most popular?</p></li>
<li><p>Facet by sex.</p></li>
</ul>
</section>
<section id="create-a-line-graph" class="level2">
<h2 class="anchored" data-anchor-id="create-a-line-graph">2. Create a line graph</h2>
Expand All @@ -197,6 +201,11 @@ <h1>Part 3. Do presidents’ names influence babies’ names?</h1>
<li><p>Choose three recent presidents (Donald Trump and Joe Biden might be too recent).</p></li>
<li><p>Make one graph that shows all three president’s names. Use <code>geom_vline()</code> to show the year they entered office.</p></li>
</ul>
</section>
<section id="part-4-most-and-least." class="level1">
<h1>Part 4: Most and least.</h1>
<p>What is the year in which the most babies were born?</p>
<p>What is the year the least babies were born?</p>


</section>
Expand Down
30 changes: 17 additions & 13 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -400,19 +400,7 @@ h1{font-weight: 400;}



<!-- <!-- [Wrangle babynames](/course-materials/in-class-activies/Wrangling_Baby_Names.qmd) -->

<!-- <!-- ```{r} -->

<!-- <!-- #| code-fold: true -->

<!-- <!-- #| echo: true -->

<!-- <!-- #| eval: false -->

<!-- <!-- install.packages("babynames") -->

<!-- <!-- ``` -->



Expand Down Expand Up @@ -461,14 +449,30 @@ h1{font-weight: 400;}

<!-- ::: -->

<!-- # Day 16 Lab 4 -->


<!-- [This is the article referred to in the lab](https://www.nyclu.org/en/stop-and-frisk-data) -->

<!-- [dpylr cheatsheet for wrangling](https://nyu-cdsc.github.io/learningr/assets/data-transformation.pdf) -->

<!-- [Here is the link](https://classroom.github.com/a/eSF9MUxn) for Lab 4. -->

# Day 16 Lab 4

[Wrangle babynames](/course-materials/in-class-activies/Wrangling_Baby_Names.qmd)

```{r}
#| code-fold: true
#| echo: true
#| eval: false
install.packages("babynames")
```

# Day 15 Data wrangling in one table.

[Lecture on the five verbs](course-materials/lectures/mdsr-the-verbs.qmd)
Expand Down

0 comments on commit 4a59c9e

Please sign in to comment.