-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathcountries_in_continents.Rmd
executable file
·49 lines (36 loc) · 1.04 KB
/
countries_in_continents.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
title: "distinct plot"
author: "Evangeline Reynolds"
date: "2/16/2019"
output: html_document
---
---
name: countriesbycontinent
## Target output: Number of Countries by Continent in Dataset
```{r wrangle_01, eval=T, echo=F, comment = " ", fig.height = preview_height}
gapminder %>%
select(country, continent) %>%
distinct() %>%
ggplot() +
aes(x = continent) +
geom_bar(fill = "blue", alpha = .4) +
labs(title = "Number of Countries by Continent in the Gapminder Dataset") +
labs(subtitle = "Data source: gapminder package in R") +
labs(x = "") +
labs(y = "Number of countries") +
labs(caption = "Vis: Gina Reynolds for 'Tidyverse in Action'") +
theme_minimal()
```
```{r, echo = F, message=F}
ggsave("figures/countries_by_continent.png")
```
---
## How do we get there?
We are going to
- use select() to keep the variables country and continent only
- pull out unique rows with distinct(), (i.e. there will be no duplicate rows).
- then we'll plot.
Let's see this in action.
---
`r apply_reveal("wrangle_01")`
---