Skip to content

Commit

Permalink
small updates
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanhcullen committed Aug 8, 2024
1 parent ca0cce7 commit 06229aa
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 75 deletions.
46 changes: 16 additions & 30 deletions slides/warm-up.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -229,33 +229,16 @@ What are the names of our three little pigs? (Pardon the reference)

Display them as a character vector.

---

# Solution 3

```{r eval = FALSE}
seattle_pets |>
filter(species == "Pig") |>
pull(animal_name)
```


```{r echo = FALSE, message = FALSE}
seattle_pets |>
filter(species == "Pig") |>
pull(animal_name)
```

---
class: your-turn

# Your Turn 4
# Your Turn 3

What is the most popular pet name in this data set? *Hint* Look up the help documentation for `slice_max()` from dplyr.

---

# Solution 4
# Solution 3

```{r eval = FALSE}
seattle_pets |>
Expand All @@ -275,13 +258,13 @@ seattle_pets |>
---
class: your-turn

# Your Turn 5
# Your Turn 4

How many different primary dog breeds are there?

---

# Solution 5
# Solution 4

.pull-left[

Expand Down Expand Up @@ -317,13 +300,13 @@ seattle_pets |>
---
class: your-turn

# Your Turn 6
# Your Turn 5

Let's narrow this down -- what are the top 10 most popular dog breeds?

---

# Solution 6
# Solution 5

```{r eval=FALSE}
seattle_pets |>
Expand All @@ -342,7 +325,7 @@ seattle_pets |>
---
class: your-turn

# Your Turn 7 -- last one!
# Your Turn 6 -- last one!

Visualize the top 10 dog breeds in a bar chart.

Expand Down Expand Up @@ -375,7 +358,7 @@ seattle_pets |>

---

# Solution 7
# Solution 6

.pull-left[

Expand Down Expand Up @@ -405,9 +388,9 @@ seattle_pets |>
]

---
class: blue, middle, center
class: inverse, middle, center

# .big-text.white[Nice work! `r emo::ji("rocket")`]
# Nice work!


---
Expand Down Expand Up @@ -448,11 +431,14 @@ We would need to handle **dates**.
seattle_pets |>
mutate(
license_issue_date = mdy(license_issue_date),
month = month(license_issue_date, label = TRUE)
month = month(license_issue_date, label = TRUE),
year = year(license_issue_date)
) |>
group_by(month, year) |>
summarize(n = n()) |>
group_by(month) |>
count() |>
ggplot(aes(month, n, group = 1)) +
summarize(mean_licenses = mean(n)) |>
ggplot(aes(month, mean_licenses, group = 1)) +
geom_point() +
geom_line()
```
Expand Down
79 changes: 34 additions & 45 deletions slides/warm-up.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@
```
## Rows: 43,683
## Columns: 7
## $ license_issue_date <chr> "December 18 2015", "June 14 2016", "August 04 2016", "February 13 2019", "August 10 2019", "November …
## $ license_number <chr> "S107948", "S116503", "S119301", "962273", "S133113", "8002549", "S112835", "S131986", "S112996", "S14…
## $ animal_name <chr> "Zen", "Misty", "Lyra", "Veronica", "Spider", "Maxx", "Diamond", "Nacho", "Pixel", "C.C.", "Gemma", "O…
## $ species <chr> "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat…
## $ primary_breed <chr> "Domestic Longhair", "Siberian", "Mix", "Domestic Longhair", "LaPerm", "American Shorthair", "Domestic…
## $ secondary_breed <chr> "Mix", NA, NA, NA, NA, NA, "Mix", "Mix", "Mix", "Mix", "American Shorthair", "Mix", NA, NA, "Mix", NA,…
## $ zip_code <dbl> 98117, 98117, 98121, 98107, 98115, 98125, 98103, 98126, 98112, 98117, 98126, 98199, 98115, 98116, 9813…
## $ license_issue_date [3m[38;5;246m<chr>[39m[23m "December 18 2015", "June 14 2016", "August 04 2016", "February 13 2019", "August 10 2019", "November …
## $ license_number [3m[38;5;246m<chr>[39m[23m "S107948", "S116503", "S119301", "962273", "S133113", "8002549", "S112835", "S131986", "S112996", "S14…
## $ animal_name [3m[38;5;246m<chr>[39m[23m "Zen", "Misty", "Lyra", "Veronica", "Spider", "Maxx", "Diamond", "Nacho", "Pixel", "C.C.", "Gemma", "O…
## $ species [3m[38;5;246m<chr>[39m[23m "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat…
## $ primary_breed [3m[38;5;246m<chr>[39m[23m "Domestic Longhair", "Siberian", "Mix", "Domestic Longhair", "LaPerm", "American Shorthair", "Domestic…
## $ secondary_breed [3m[38;5;246m<chr>[39m[23m "Mix", NA, NA, NA, NA, NA, "Mix", "Mix", "Mix", "Mix", "American Shorthair", "Mix", NA, NA, "Mix", NA,…
## $ zip_code [3m[38;5;246m<dbl>[39m[23m 98117, 98117, 98121, 98107, 98115, 98125, 98103, 98126, 98112, 98117, 98126, 98199, 98115, 98116, 9813…
```


Expand All @@ -141,13 +141,13 @@
```
## Rows: 43,683
## Columns: 7
## $ license_issue_date <chr> "December 18 2015", "June 14 2016", "August 04 2016", "February 13 2019", "August 10 2019", "November …
## $ license_number <chr> "S107948", "S116503", "S119301", "962273", "S133113", "8002549", "S112835", "S131986", "S112996", "S14…
## $ animal_name <chr> "Zen", "Misty", "Lyra", "Veronica", "Spider", "Maxx", "Diamond", "Nacho", "Pixel", "C.C.", "Gemma", "O…
## $ species <chr> "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat…
## $ primary_breed <chr> "Domestic Longhair", "Siberian", "Mix", "Domestic Longhair", "LaPerm", "American Shorthair", "Domestic…
## $ secondary_breed <chr> "Mix", NA, NA, NA, NA, NA, "Mix", "Mix", "Mix", "Mix", "American Shorthair", "Mix", NA, NA, "Mix", NA,…
## $ zip_code <dbl> 98117, 98117, 98121, 98107, 98115, 98125, 98103, 98126, 98112, 98117, 98126, 98199, 98115, 98116, 9813…
## $ license_issue_date [3m[38;5;246m<chr>[39m[23m "December 18 2015", "June 14 2016", "August 04 2016", "February 13 2019", "August 10 2019", "November …
## $ license_number [3m[38;5;246m<chr>[39m[23m "S107948", "S116503", "S119301", "962273", "S133113", "8002549", "S112835", "S131986", "S112996", "S14…
## $ animal_name [3m[38;5;246m<chr>[39m[23m "Zen", "Misty", "Lyra", "Veronica", "Spider", "Maxx", "Diamond", "Nacho", "Pixel", "C.C.", "Gemma", "O…
## $ species [3m[38;5;246m<chr>[39m[23m "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat…
## $ primary_breed [3m[38;5;246m<chr>[39m[23m "Domestic Longhair", "Siberian", "Mix", "Domestic Longhair", "LaPerm", "American Shorthair", "Domestic…
## $ secondary_breed [3m[38;5;246m<chr>[39m[23m "Mix", NA, NA, NA, NA, NA, "Mix", "Mix", "Mix", "Mix", "American Shorthair", "Mix", NA, NA, "Mix", NA,…
## $ zip_code [3m[38;5;246m<dbl>[39m[23m 98117, 98117, 98121, 98107, 98115, 98125, 98103, 98126, 98112, 98117, 98126, 98199, 98115, 98116, 9813…
```

---
Expand Down Expand Up @@ -201,33 +201,16 @@

Display them as a character vector.

---

# Solution 3


```r
seattle_pets |>
filter(species == "Pig") |>
pull(animal_name)
```



```
## [1] "Millie" "Calvin" "Waffles Olivia McHart"
```

---
class: your-turn

# Your Turn 4
# Your Turn 3

What is the most popular pet name in this data set? *Hint* Look up the help documentation for `slice_max()` from dplyr.

---

# Solution 4
# Solution 3


```r
Expand All @@ -246,13 +229,13 @@
---
class: your-turn

# Your Turn 5
# Your Turn 4

How many different primary dog breeds are there?

---

# Solution 5
# Solution 4

.pull-left[

Expand Down Expand Up @@ -288,13 +271,13 @@
---
class: your-turn

# Your Turn 6
# Your Turn 5

Let's narrow this down -- what are the top 10 most popular dog breeds?

---

# Solution 6
# Solution 5


```r
Expand Down Expand Up @@ -324,7 +307,7 @@
---
class: your-turn

# Your Turn 7 -- last one!
# Your Turn 6 -- last one!

Visualize the top 10 dog breeds in a bar chart.

Expand All @@ -344,13 +327,13 @@
]

.pull-right[
<img src="warm-up_files/figure-html/unnamed-chunk-18-1.png" width="80%" />
<img src="warm-up_files/figure-html/unnamed-chunk-16-1.png" width="80%" />

]

---

# Solution 7
# Solution 6

.pull-left[

Expand All @@ -368,14 +351,14 @@
]

.pull-right[
<img src="warm-up_files/figure-html/unnamed-chunk-20-1.png" width="80%" />
<img src="warm-up_files/figure-html/unnamed-chunk-18-1.png" width="80%" />

]

---
class: blue, middle, center
class: inverse, middle, center

# .big-text.white[Nice work! 🚀]
# Nice work!


---
Expand All @@ -388,7 +371,7 @@
]

.pull-right[
<img src="warm-up_files/figure-html/unnamed-chunk-21-1.png" width="90%" />
<img src="warm-up_files/figure-html/unnamed-chunk-19-1.png" width="90%" />

]

Expand All @@ -403,7 +386,12 @@

.pull-right[

<img src="warm-up_files/figure-html/unnamed-chunk-22-1.png" width="90%" />

```
## `summarise()` has grouped output by 'month'. You can override using the `.groups` argument.
```

<img src="warm-up_files/figure-html/unnamed-chunk-20-1.png" width="90%" />

]

Expand Down Expand Up @@ -457,6 +445,7 @@
Fortunately, the tidyverse provides us with tools to work with these different types of data...

<br>

.center[

<img src="https://github.com/rstudio/hex-stickers/blob/main/PNG/stringr.png?raw=true" width="25%" /><img src="https://github.com/rstudio/hex-stickers/blob/main/PNG/forcats.png?raw=true" width="25%" /><img src="https://github.com/rstudio/hex-stickers/blob/main/PNG/lubridate.png?raw=true" width="25%" />
Expand Down

0 comments on commit 06229aa

Please sign in to comment.