I will plot the global prevalence of anxiety disorders with data from Institute of Health Metrics & Evaluation (IHME). Inspiration is drawn from Our World in Data
# Data cleaning
ihme_percent <- ihme_raw %>%
filter(metric == "Percent") %>%
select(location, cause, year, val, upper, lower)
iso3166_revised <- maps::iso3166 %>%
mutate(ISOname = case_when(
ISOname == "United States" ~ "United States of America",
ISOname == "Bolivia, Plurinational State of" ~ "Bolivia",
ISOname == "Venezuela, Bolivarian Republic of" ~ "Venezuela",
ISOname == "United Kingdom of Great Britain and Northern Ireland" ~ "United Kingdom",
ISOname == "Iran, Islamic Republic of" ~ "Iran",
ISOname == "Lao People's Democratic Republic" ~ "Laos",
ISOname == "Tanzania, United Republic of" ~ "Tanzania",
TRUE ~ ISOname
))
world_data <- ihme_percent %>%
filter(cause == "Anxiety disorders") %>%
mutate(location = case_when(
location == "Bolivia (Plurinational State of)" ~ "Bolivia",
location == "Venezuela (Bolivarian Republic of)" ~ "Venezuela",
location == "Iran (Islamic Republic of)" ~ "Iran",
location == "Viet Nam" ~ "Vietnam",
location == "Lao People's Democratic Republic" ~ "Laos",
location == "Taiwan (Province of China)" ~ "Taiwan",
TRUE ~ location
)) %>%
inner_join(iso3166_revised, by = c(location = "ISOname"))
final_df <- map_data("world") %>%
as_tibble() %>%
filter(region != "Antarctica") %>%
mutate(region = case_when(
region == "Russia" ~ "Russian Federation",
region == "USA" ~ "United States of America",
region == "South Korea" ~ "Republic of Korea",
region == "North Korea" ~ "Democratic People's Republic of Korea",
region == "UK" ~ "United Kingdom",
TRUE ~ region
)) %>%
regex_left_join(world_data, by = c("region" = "location")) %>%
filter(!is.na(year)) %>%
# Take out unnecessary columns
select(-order, -region, -subregion, -location,
-cause, -upper, -lower, -a2, -a3, -mapname,
-sovereignty)
# Animate
final_df %>%
ggplot(aes(long, lat, group = group, fill = val)) +
geom_polygon() +
geom_polygon(color = "black", alpha = 0.4) +
transition_time(year) +
scale_fill_gradient2(low = "lightgreen", high = "forestgreen", midpoint = 0.05, na.value = "grey",
labels = scales::percent) +
theme_map() +
theme(legend.position = "bottom",
text = element_text(size = 12, family="Palatino")) +
labs(fill = "Prevalence of Anxiety Disorders",
title = "Global Prevalence of Anxiety Disorder in {round(frame_time, 0)}",
subtitle = "Share of population with an anxiety disorder. Figures attempt to provide a true estimate (going beyond
reported diagnosis) of anxiety disorder prevalence based on medical, epidemiological data, surveys and
meta-regression modelling.",
caption = "Source: Our World in Data / IHME, Global Burden of Disease")