Skip to content

Instantly share code, notes, and snippets.

@bgonzalezbustamante
Last active April 20, 2020 13:43
Show Gist options
  • Save bgonzalezbustamante/0adcf82d1c9842cc742b40c50547a478 to your computer and use it in GitHub Desktop.
Save bgonzalezbustamante/0adcf82d1c9842cc742b40c50547a478 to your computer and use it in GitHub Desktop.
Career Trajectories CPS-Ranking
##############################################################
## Trajectories Analysis CPS-Ranking
## R version 3.6.1 (2019-07-05) -- "Action of the Toes"
## Date: March 2020
## Bastián González-Bustamante
## University of Oxford
## E-mail: bastian.gonzalezbustamante@politics.ox.ac.uk
## Website: http://users.ox.ac.uk/~shil5311/
## Chilean Political Science Impact Ranking
## OSF-Project DOI: 10.17605/OSF.IO/C8PRA
## http://users.ox.ac.uk/~shil5311/ranking/
##############################################################
## Packages
library(scholar)
library(ggplot2)
library(tidyverse)
## Data
## DOI: 10.17605/OSF.IO/M3NZD
data <- read.csv('20200305_ranking.csv')
names(data)[1] = "Ranking"
## CAREER TRAJECTORIES
topten_data <- subset(data, Ranking < 11)
topten_data <- droplevels(topten_data)
topten_data$ID
csc <- compare_scholar_careers(topten_data$ID)
csc$name <- lapply(csc$name, tolower)
simpleCap <- function(x) {
s <- strsplit(x, " ")[[1]]
paste(toupper(substring(s, 1,1)), substring(s, 2),
sep="", collapse=" ")
}
csc$name <- sapply(csc$name, simpleCap)
names(csc)[5] = "Name"
## H-Index ranking x N (career years in table) BY HAND
csc$Name
## table(csc$Name)
csc <- add_column(csc, ranking = c(rep(4, 10), rep(7, 20),
rep(9, 20), rep(3, 23),
rep(5, 18), rep(6, 17),
rep(10, 19), rep(2, 20),
rep(8, 36), rep(1, 19)
))
png("Careers-Mar-2020.png", width = 5, height = 5, units = 'in', res = 300)
ggplot(csc, aes(career_year, cites, group=factor(ranking),
color=factor(ranking,
labels = c("David Altman",
"Lucia Dammert",
"Peter Siavelis",
"Cristóbal Rovira",
"Patricio D Navia",
"Juan Pablo Luna",
"Gabriel L. Negretto",
"Carlos Huneeus",
"Alfredo Joignant",
"Fernando Atria")))) +
labs(title = "Career Trajectories of the Top-10 Ranked",
subtitle = "March 2020",
caption = "Source: Compiled using data from González-Bustamante (2020). \n DOI: 10.17605/OSF.IO/M3NZD.",
y = "Cites", x = "Career Year") +
scale_colour_discrete(name = NULL) +
geom_line() + geom_point() + theme_minimal() +
theme(legend.position="bottom") +
guides(col = guide_legend(nrow = 4))
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment