Jayden Hunt Insert date here
## [1] 935 26
935 observations 26 variables
nobel_living <- nobel_living %>%
mutate(
country_us = if_else(country == "USA", "USA", "Other")
)
nobel_living_science <- nobel_living %>%
filter(category %in% c("Physics", "Medicine", "Chemistry", "Economics"))
ggplot(nobel_living_science, aes(x = category, fill = country_us)) +
geom_bar() +
labs(title = "Category of Prize by Country", x = "Category of Prize", y = "Count") + coord_flip() + facet_wrap(~ category) ## # A tibble: 34 × 2
## born_country n
## <chr> <int>
## 1 Algeria 1
## 2 Australia 3
## 3 Austria 2
## 4 Belgium 1
## 5 Canada 6
## 6 China 6
## 7 Cyprus 1
## 8 Finland 1
## 9 France 8
## 10 Germany 20
## # ℹ 24 more rows
105 born in the USA
ggplot(nobel_living_science,
aes (x = country_us, fill = born_country)) +
geom_bar() +
facet_wrap(~category) +
coord_flip () +
labs(
title = "Nobel laureates US affiliation and birth country",
x = "Where laureates was based when awarded" ,
y = "# of laureates",
fill = "born in")nobel_born_count <- nobel_living_science %>%
mutate(
born_country_us = if_else(born_country == "USA", "USA", "Other")
)## # A tibble: 33 × 2
## born_country n
## <chr> <int>
## 1 Germany 20
## 2 Japan 17
## 3 United Kingdom 16
## 4 France 8
## 5 Canada 6
## 6 China 6
## 7 Switzerland 6
## 8 Israel 5
## 9 Norway 4
## 10 Australia 3
## # ℹ 23 more rows
Germany is the most common country