Created
January 23, 2018 12:39
-
-
Save charliejhadley/2c6f55b280ebe80774cdf840f978e91f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("tidyverse") | |
journeys <- read_csv("data/clean-journeys.csv") | |
journeys %>% | |
count(start.country, date) | |
journeys %>% | |
group_by(start.country) %>% # hello! | |
select(end.country, number.of.letters) %>% | |
mutate(total.letters = sum(number.of.letters)) | |
journeys %>% | |
group_by(start.country) %>% # hello! | |
summarise(total.letters = sum(number.of.letters)) %>% | |
arrange(desc(total.letters)) %>% | |
mutate(start.country = fct_reorder(start.country, | |
total.letters)) %>% | |
select(start.country) %>% | |
.[[1]] | |
journeys %>% | |
group_by(start.country) %>% # hello! | |
summarise(total.letters = sum(number.of.letters)) %>% | |
arrange(desc(total.letters)) %>% | |
mutate(start.country = fct_reorder(start.country, | |
total.letters)) %>% | |
ggplot(aes(x = start.country, | |
y = total.letters)) + | |
geom_col() + | |
coord_flip() | |
journeys %>% | |
group_by(start.country) %>% # hello! | |
summarise(total.letters = sum(number.of.letters)) %>% | |
ggplot(aes(x = start.country, | |
y = total.letters)) + | |
geom_col() + | |
coord_flip() | |
ggplot() + | |
geom_col( | |
data = journeys %>% | |
group_by(start.country) %>% # hello! | |
summarise(total.letters = sum(number.of.letters)), | |
aes(x = start.country, | |
y = total.letters) | |
) + | |
coord_flip() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment