Code
library(dplyr)
library(tidyr)
library(purrr)
library(ggplot2)
library(myPackage)
data("unemp")
<- unemp %>%
unemp ::clean_names() %>%
janitorfilter(level == "Commune")
library(dplyr)
library(tidyr)
library(purrr)
library(ggplot2)
library(myPackage)
data("unemp")
<- unemp %>%
unemp ::clean_names() %>%
janitorfilter(level == "Commune")
There are 105 communes in the dataset. Below we plot the unemployment rate for 3 communes:
%>%
unemp filter(place_name %in% c("Luxembourg", "Esch-sur-Alzette", "Wiltz")) %>%
group_by(place_name) %>%
nest() %>%
mutate(plots = map2(.x = data, .y = place_name, ~ggplot(data = .x) +
theme_minimal() +
geom_line(aes(year, unemployment_rate_in_percent, group = 1)) +
labs(title = paste("Unemployment in", .y)))) %>%
pull(plots)
[[1]]
[[2]]
[[3]]