Skip to content

Commit fc51ce1

Browse files
committed
updates to exercises
1 parent 1a741b9 commit fc51ce1

8 files changed

+33
-314
lines changed

1-got_nyt.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Game of Thromes Character Ratings"
33
author: "Angela Zoss"
4-
date: "1/30/2020"
4+
date: "3/23/2021"
55
output: html_document
66
---
77

1-got_nyt_final.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Game of Thromes Character Ratings"
33
author: "Angela Zoss"
4-
date: "1/30/2020"
4+
date: "3/23/2021"
55
output: html_document
66
---
77

@@ -56,7 +56,7 @@ ggplot(got, aes(x=moral,y=physical)) +
5656
5757
# hint: check https://ggplot2.tidyverse.org/reference/#section-layer-geoms for all geom options
5858
59-
# wrong way: aes() in geom_point does not carry down; has to be in ggplot()
59+
# wrong way: aes() in geom_point does not carry down; has to be in ggplot() or in both geom layers
6060
6161
#ggplot(got) +
6262
# geom_point(aes(x=moral,y=physical)) +

2-starwars_characters.Rmd

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Star Wars Character Data"
33
author: "Angela Zoss"
4-
date: "1/30/2020"
4+
date: "3/23/2021"
55
output: html_document
66
---
77

@@ -56,22 +56,21 @@ starwars_chars <- starwars
5656
5757
```
5858

59-
## Add a linear trend line
59+
## Data inheritance: Add a label to (only) the heaviest character
6060

6161
```{r}
6262
63-
# hint: look at the options for geom_smooth
63+
# hint: you can use "data=" in a geom layer to use different data for that layer
6464
6565
6666
6767
```
6868

69-
70-
## Data inheritance: Add a label to (only) the heaviest character
69+
## Advanced: Add a linear trend line
7170

7271
```{r}
7372
74-
# hint: you can use "data=" in a geom layer to use different data for that layer
73+
# hint: look at the options for geom_smooth
7574
7675
7776

2-starwars_characters_final.Rmd

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Star Wars Character Data"
33
author: "Angela Zoss"
4-
date: "1/30/2020"
4+
date: "3/23/2021"
55
output: html_document
66
---
77

@@ -60,34 +60,33 @@ ggplot(starwars_chars, aes(height,mass)) +
6060
6161
```
6262

63-
## Add a linear trend line
63+
## Data inheritance: Add a label to (only) the heaviest character
6464

6565
```{r}
6666
67-
# hint: look at the options for geom_smooth
67+
# hint: you can use "data=" in a geom layer to use different data for that layer
6868
6969
ggplot(starwars_chars, aes(height,mass)) +
7070
geom_point() +
71-
geom_smooth(method = "lm", se=FALSE)
71+
geom_text(data=starwars_chars %>% dplyr::filter(mass > 1000), aes(label=name), nudge_y = -50)
7272
73-
```
73+
ggplot(starwars_chars, aes(height,mass)) +
74+
geom_point() +
75+
geom_text(data=starwars_chars %>% dplyr::filter(mass == max(mass, na.rm=T)), aes(label=name), nudge_y = -50)
7476
77+
```
7578

76-
## Data inheritance: Add a label to (only) the heaviest character
79+
## Advanced: Add a linear trend line
7780

7881
```{r}
7982
80-
# hint: you can use "data=" in a geom layer to use different data for that layer
81-
82-
ggplot(starwars_chars, aes(height,mass)) +
83-
geom_point() +
84-
geom_smooth(method = "lm", se=FALSE) +
85-
geom_text(data=starwars_chars %>% dplyr::filter(mass > 1000), aes(label=name), nudge_y = -50)
83+
# hint: look at the options for geom_smooth
8684
8785
ggplot(starwars_chars, aes(height,mass)) +
8886
geom_point() +
89-
geom_smooth(method = "lm", se=FALSE) +
90-
geom_text(data=starwars_chars %>% dplyr::filter(mass == max(mass, na.rm=T)), aes(label=name), nudge_y = -50)
87+
geom_smooth(method = "lm", se=FALSE)
9188
9289
```
9390

91+
92+

3-starwars_opinions.Rmd

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Star Wars Opinion Data"
33
author: "Angela Zoss"
4-
date: "2/18/19"
4+
date: "3/23/21"
55
output: html_document
66
---
77

@@ -37,7 +37,6 @@ solo <- starwars_opins_tidy %>% dplyr::filter(Character=="Solo")
3737
jarjar <- starwars_opins_tidy %>% dplyr::filter(Character == "JarJar")
3838
combined <- bind_rows(solo, jarjar)
3939
40-
4140
```
4241

4342
## Plot the opinions for Han Solo
@@ -114,4 +113,13 @@ opinion.colors <- c("grey50","firebrick4","firebrick1","grey85","dodgerblue1","d
114113
115114
```
116115

116+
## Advanced: Explore full dataset using new chart formatting
117+
118+
```{r}
119+
120+
starwars_opins_tidy.f <- starwars_opins_tidy %>%
121+
mutate(Opinion=factor(Opinion, opinion.levels))
122+
123+
124+
```
117125

3-starwars_opinions_final.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Star Wars Opinion Data"
33
author: "Angela Zoss"
4-
date: "8/14/19"
4+
date: "3/23/21"
55
output: html_document
66
---
77

@@ -140,7 +140,7 @@ ggplot(combined.f) +
140140
141141
```
142142

143-
## Explore full dataset using new chart formatting
143+
## Advanced: Explore full dataset using new chart formatting
144144

145145
```{r}
146146

5-mapping-examples.Rmd

Lines changed: 0 additions & 205 deletions
This file was deleted.

0 commit comments

Comments
 (0)