rm(list = ls())
Sys.setenv(LANG = "en")
library(xlsx)
library(readr)
library(readxl)
library(tidyverse)
library(stringr)
library(stringi)
library(gghighlight)
library(countrycode)
library(countries)
library(janitor)
library(sf)
library(janitor)
library(sf)
library(ggthemes)
library(here)
library(viridis)
library(ggplot2)
library(formatR)
library(gtools)
library(nnet)
library(patchwork)
library(ggh4x)
library(plm)
library(broom)
library(ggalluvial)
library(pals)
aggregates <- read_csv("../aggregated_data/aggregates.csv")
aggregates_year <- read_csv("../aggregated_data/aggregates_year.csv")
aggregates_year <- aggregates_year %>%
mutate(subregion_rf = as_factor(subregion),
subregion_rf = relevel(subregion_rf, "Northern America"),
continent = as_factor(continent),
continent = relevel(continent, "Americas"))
myColors <- alphabet2()
names(myColors) <- levels(aggregates_year$subregion_rf)
(salience_subregions <- aggregates_year %>%
filter(!is.na(subregion_rf)) %>%
group_by(pubyear, continent, subregion_rf) %>%
summarise(n = sum(art_country_y)) %>%
ggplot() +
geom_bar(mapping = aes(x = pubyear, y = n, group = subregion_rf, fill = subregion_rf), stat = "identity") +
facet_wrap(vars(continent)) +
theme_minimal() +
theme(legend.title = element_blank(),
legend.text = element_text(size = 22),
legend.position = "bottom",
axis.text = element_text(size = 25),
axis.title=element_text(size = 25),
strip.text = element_text(size = 25)) +
labs(fill = "Subregion UN classification",
y = "Research salience",
x = "Publication year") +
scale_fill_manual(name = "subregion_rf", values = myColors))
ggsave("../output_figures/subregions_year_abs.png", width = 50, height = 30, units = "cm", dpi = 700, scale = 1, plot = last_plot())
(repr_subregions <- aggregates_year %>%
filter(!is.na(subregion_rf)) %>%
count(continent, subregion_rf, pubyear, repr_y_s) %>%
filter(repr_y_s == "Under") %>%
ggplot() +
geom_bar(mapping = aes(x = pubyear, y = n, group = subregion_rf, fill = subregion_rf), stat = "identity") +
facet_wrap(vars(continent)) +
theme_minimal() +
theme(legend.title = element_blank(),
legend.text = element_text(size = 22),
legend.position = "bottom",
axis.text = element_text(size = 25),
axis.title=element_text(size = 25),
strip.text = element_text(size = 25)) +
labs(fill = "Subregion UN classification",
y = "Counts of under-rerepresented countries",
x = "Publication year") +
scale_fill_manual(name = "subregion_rf", values = myColors))
ggsave("../output_figures/representation_subregions_year_abs.png", width = 50, height = 30, units = "cm", dpi = 700, scale = 1, plot = last_plot())
(repr_subregions <- aggregates_year %>%
filter(!is.na(subregion_rf)) %>%
count(continent, subregion_rf, pubyear, repr_y_s) %>%
filter(repr_y_s == "Under") %>%
ggplot() +
geom_bar(mapping = aes(x = pubyear, y = n, group = subregion_rf, fill = subregion_rf), stat = "identity") +
facet_wrap(vars(continent)) +
theme_minimal() +
theme(legend.position = "none",
axis.text = element_text(size = 25),
axis.title=element_text(size = 25),
strip.text = element_text(size = 25)) +
labs(fill = "Subregion UN classification",
y = "Counts of under-rerepresented countries",
x = "Publication year") +
scale_fill_manual(name = "subregion_rf", values = myColors))
salience_subregions / repr_subregions
ggsave("../output_figures/subregions_both.png", width = 50, height = 60, units = "cm", dpi = 700, scale = 1, plot = last_plot())