Skip to content

Commit

Permalink
small edits and notes
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanhcullen committed Aug 11, 2024
1 parent 9ddc1f7 commit 2ed223a
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 82 deletions.
14 changes: 14 additions & 0 deletions slides/data-types.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ if (!is.null(rmarkdown::metadata$shortlink)) {
---
class: inverse

# Conf - Data types

```{r echo=FALSE, out.width="60%"}
knitr::include_graphics("images/data-types/campsite-data-types.png")
```

???

Go ahead and open the milestone labeled "Conf - Data types" in the campsite.
We'll be using this for a few exercises as we go along.

---
class: inverse

# Data types

Strings, factors and dates
Expand Down
119 changes: 67 additions & 52 deletions slides/data-types.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@



---
class: inverse

# Conf - Data types

<img src="images/data-types/campsite-data-types.png" width="60%" />

???

Go ahead and open the milestone labeled "Conf - Data types" in the campsite.
We'll be using this for a few exercises as we go along.

---
class: inverse

Expand Down Expand Up @@ -99,16 +111,16 @@

```
## # A tibble: 195 × 15
## breed affection shedding drooling openness playfulness protectiveness adaptability trainability energy barking stimulation_needs
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Retrievers (… 5 4 2 5 5 3 5 5 5 3 4
## 2 French Bulld… 5 3 3 5 5 3 5 4 3 1 3
## 3 German Sheph… 5 4 2 3 4 5 5 5 5 3 5
## 4 Retrievers (… 5 4 2 5 4 3 5 5 3 1 4
## 5 Bulldogs 4 3 3 4 4 3 3 4 3 2 3
## 6 Poodles 5 1 1 5 5 5 4 5 4 4 5
## breed affection shedding drooling openness playfulness protectiveness adaptability trainability energy barking
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Retriev… 5 4 2 5 5 3 5 5 5 3
## 2 French … 5 3 3 5 5 3 5 4 3 1
## 3 German … 5 4 2 3 4 5 5 5 5 3
## 4 Retriev… 5 4 2 5 4 3 5 5 3 1
## 5 Bulldogs 4 3 3 4 4 3 3 4 3 2
## 6 Poodles 5 1 1 5 5 5 4 5 4 4
## # ℹ 189 more rows
## # ℹ 3 more variables: good_w_children <dbl>, good_w_other_dogs <dbl>, grooming_freq <dbl>
## # ℹ 4 more variables: stimulation_needs <dbl>, good_w_children <dbl>, good_w_other_dogs <dbl>, grooming_freq <dbl>
```


Expand Down Expand Up @@ -156,10 +168,10 @@

```
## # A tibble: 1 × 15
## breed affection shedding drooling openness playfulness protectiveness adaptability trainability energy barking stimulation_needs
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Yorkshire Te… 5 1 1 5 4 5 5 4 4 4 4
## # ℹ 3 more variables: good_w_children <dbl>, good_w_other_dogs <dbl>, grooming_freq <dbl>
## breed affection shedding drooling openness playfulness protectiveness adaptability trainability energy barking
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Yorkshi… 5 1 1 5 4 5 5 4 4 4
## # ℹ 4 more variables: stimulation_needs <dbl>, good_w_children <dbl>, good_w_other_dogs <dbl>, grooming_freq <dbl>
```

???
Expand All @@ -186,11 +198,11 @@

```
## # A tibble: 2 × 15
## breed affection shedding drooling openness playfulness protectiveness adaptability trainability energy barking stimulation_needs
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Yorkshire Te… 5 1 1 5 4 5 5 4 4 4 4
## 2 Boston Terri… 5 2 1 5 5 3 3 4 4 2 3
## # ℹ 3 more variables: good_w_children <dbl>, good_w_other_dogs <dbl>, grooming_freq <dbl>
## breed affection shedding drooling openness playfulness protectiveness adaptability trainability energy barking
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Yorkshi… 5 1 1 5 4 5 5 4 4 4
## 2 Boston … 5 2 1 5 5 3 3 4 4 2
## # ℹ 4 more variables: stimulation_needs <dbl>, good_w_children <dbl>, good_w_other_dogs <dbl>, grooming_freq <dbl>
```

???
Expand Down Expand Up @@ -247,20 +259,20 @@

```
## # A tibble: 36 × 15
## breed affection shedding drooling openness playfulness protectiveness adaptability trainability energy barking stimulation_needs
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Yorkshire T… 5 1 1 5 4 5 5 4 4 4 4
## 2 Boston Terr… 5 2 1 5 5 3 3 4 4 2 3
## 3 West Highla… 5 3 1 4 5 5 4 3 4 5 4
## 4 Scottish Te… 5 2 2 3 4 5 4 3 3 4 4
## 5 Soft Coated… 5 1 2 3 3 3 3 3 4 3 3
## 6 Airedale Te… 3 1 1 3 3 5 3 3 3 3 3
## 7 Bull Terrie… 4 3 1 4 4 3 3 3 4 3 4
## 8 Russell Ter… 5 3 1 5 5 4 4 3 5 4 5
## 9 Cairn Terri… 4 2 1 3 4 4 3 3 3 4 3
## 10 Staffordshi… 5 2 3 4 4 5 5 5 4 3 4
## breed affection shedding drooling openness playfulness protectiveness adaptability trainability energy barking
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Yorksh… 5 1 1 5 4 5 5 4 4 4
## 2 Boston… 5 2 1 5 5 3 3 4 4 2
## 3 West H… 5 3 1 4 5 5 4 3 4 5
## 4 Scotti… 5 2 2 3 4 5 4 3 3 4
## 5 Soft C… 5 1 2 3 3 3 3 3 4 3
## 6 Aireda… 3 1 1 3 3 5 3 3 3 3
## 7 Bull T… 4 3 1 4 4 3 3 3 4 3
## 8 Russel… 5 3 1 5 5 4 4 3 5 4
## 9 Cairn … 4 2 1 3 4 4 3 3 3 4
## 10 Staffo… 5 2 3 4 4 5 5 5 4 3
## # ℹ 26 more rows
## # ℹ 3 more variables: good_w_children <dbl>, good_w_other_dogs <dbl>, grooming_freq <dbl>
## # ℹ 4 more variables: stimulation_needs <dbl>, good_w_children <dbl>, good_w_other_dogs <dbl>, grooming_freq <dbl>
```

???
Expand Down Expand Up @@ -379,20 +391,22 @@
```

```
## [1] "apple" "apricot" "avocado" "banana" "bell pepper" "bilberry"
## [7] "blackberry" "blackcurrant" "blood orange" "blueberry" "boysenberry" "breadfruit"
## [13] "canary melon" "cantaloupe" "cherimoya" "cherry" "chili pepper" "clementine"
## [19] "cloudberry" "coconut" "cranberry" "cucumber" "currant" "damson"
## [25] "date" "dragonfruit" "durian" "eggplant" "elderberry" "feijoa"
## [31] "fig" "goji berry" "gooseberry" "grape" "grapefruit" "guava"
## [37] "honeydew" "huckleberry" "jackfruit" "jambul" "jujube" "kiwi fruit"
## [43] "kumquat" "lemon" "lime" "loquat" "lychee" "mandarine"
## [49] "mango" "mulberry" "nectarine" "nut" "olive" "orange"
## [55] "pamelo" "papaya" "passionfruit" "peach" "pear" "persimmon"
## [61] "physalis" "pineapple" "plum" "pomegranate" "pomelo" "purple mangosteen"
## [67] "quince" "raisin" "rambutan" "raspberry" "redcurrant" "rock melon"
## [73] "salal berry" "satsuma" "star fruit" "strawberry" "tamarillo" "tangerine"
## [79] "ugli fruit" "watermelon"
## [1] "apple" "apricot" "avocado" "banana" "bell pepper"
## [6] "bilberry" "blackberry" "blackcurrant" "blood orange" "blueberry"
## [11] "boysenberry" "breadfruit" "canary melon" "cantaloupe" "cherimoya"
## [16] "cherry" "chili pepper" "clementine" "cloudberry" "coconut"
## [21] "cranberry" "cucumber" "currant" "damson" "date"
## [26] "dragonfruit" "durian" "eggplant" "elderberry" "feijoa"
## [31] "fig" "goji berry" "gooseberry" "grape" "grapefruit"
## [36] "guava" "honeydew" "huckleberry" "jackfruit" "jambul"
## [41] "jujube" "kiwi fruit" "kumquat" "lemon" "lime"
## [46] "loquat" "lychee" "mandarine" "mango" "mulberry"
## [51] "nectarine" "nut" "olive" "orange" "pamelo"
## [56] "papaya" "passionfruit" "peach" "pear" "persimmon"
## [61] "physalis" "pineapple" "plum" "pomegranate" "pomelo"
## [66] "purple mangosteen" "quince" "raisin" "rambutan" "raspberry"
## [71] "redcurrant" "rock melon" "salal berry" "satsuma" "star fruit"
## [76] "strawberry" "tamarillo" "tangerine" "ugli fruit" "watermelon"
```

???
Expand All @@ -418,8 +432,9 @@
```

```
## [1] "bell pepper" "blood orange" "canary melon" "chili pepper" "goji berry" "kiwi fruit"
## [7] "purple mangosteen" "rock melon" "salal berry" "star fruit" "ugli fruit"
## [1] "bell pepper" "blood orange" "canary melon" "chili pepper" "goji berry"
## [6] "kiwi fruit" "purple mangosteen" "rock melon" "salal berry" "star fruit"
## [11] "ugli fruit"
```

---
Expand Down Expand Up @@ -483,7 +498,7 @@
```
]
.pull-right[
<img src="data-types_files/figure-html/unnamed-chunk-21-1.png" width="90%" />
<img src="data-types_files/figure-html/unnamed-chunk-22-1.png" width="90%" />
]

---
Expand All @@ -501,13 +516,13 @@
]

.pull-right[
<img src="data-types_files/figure-html/unnamed-chunk-23-1.png" width="90%" />
<img src="data-types_files/figure-html/unnamed-chunk-24-1.png" width="90%" />
]

---
# What are we trying to show?

![](data-types_files/figure-html/unnamed-chunk-24-1.png)<!-- -->
![](data-types_files/figure-html/unnamed-chunk-25-1.png)<!-- -->

---
# Factors have an ordering
Expand Down Expand Up @@ -576,7 +591,7 @@
]

.pull-right[
<img src="data-types_files/figure-html/unnamed-chunk-28-1.png" width="90%" />
<img src="data-types_files/figure-html/unnamed-chunk-29-1.png" width="90%" />
]

---
Expand All @@ -598,7 +613,7 @@
]

.pull-right[
<img src="data-types_files/figure-html/unnamed-chunk-30-1.png" width="90%" />
<img src="data-types_files/figure-html/unnamed-chunk-31-1.png" width="90%" />
]

---
Expand Down
Binary file added slides/images/data-types/campsite-data-types.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 9 additions & 7 deletions slides/warm-up.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,15 @@ seattle_pets |>
---
class: your-turn

# Your Turn 5 -- last one!
# Your Turn 5 (last one!)

**Visualize the top 10 dog breeds, re-creating the plot below.**

.pull-left[

`r emo::ji("bulb")` Hint: Start with your code from the previous exercise:
`r emo::ji("bulb")` Hint: Pay close attention to the x and y axes

`r emo::ji("bulb")` Hint: Start with your code from the previous exercise, and pipe this code to `ggplot()`:

```{r eval=FALSE}
seattle_pets |>
Expand Down Expand Up @@ -376,9 +378,8 @@ seattle_pets |>
filter(species == "Dog") |>
count(primary_breed) |>
slice_max(order_by = n, n = 10) |>
ggplot(aes(x = primary_breed, y = n)) +
geom_col() +
coord_flip()
ggplot(aes(x = n, y = primary_breed)) +
geom_col()
```

or ...
Expand All @@ -388,8 +389,9 @@ seattle_pets |>
filter(species == "Dog") |>
count(primary_breed) |>
slice_max(order_by = n, n = 10) |>
ggplot(aes(x = n, y = primary_breed)) +
geom_col()
ggplot(aes(x = primary_breed, y = n)) +
geom_col() +
coord_flip()
```

]
Expand Down
Loading

0 comments on commit 2ed223a

Please sign in to comment.