-
Notifications
You must be signed in to change notification settings - Fork 0
/
polsci_journals.R
60 lines (42 loc) · 1.45 KB
/
polsci_journals.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
needs(rvest, tidyverse)
source("extract_harvard.R")
# AJPS
ajps_urls <- str_c("https://dataverse.harvard.edu/dataverse/ajps?q=&types=dataverses%3Adatasets&sort=dateSort&order=desc&page=", 1:65)
ajps <- map(ajps_urls, safely(extract_harvard), .progress = TRUE)
ajps_bind <- ajps |>
map('result') |>
compact() |>
bind_rows()|>
mutate(journal = "ajps") |>
write_csv("data/ajps_replication.csv")
# APSR
apsr_urls <- str_c("https://dataverse.harvard.edu/dataverse/the_review?q=&types=dataverses%3Adatasets&sort=dateSort&order=desc&page=", 1:54)
apsr <- map(apsr_urls, safely(extract_harvard), .progress = TRUE)
apsr_bind <- apsr |>
map('result') |>
compact() |>
bind_rows() |>
mutate(journal = "apsr") |>
write_csv("data/apsr_replication.csv")
# JOP
jop_urls <- str_c("https://dataverse.harvard.edu/dataverse/jop?q=&types=dataverses%3Adatasets&sort=dateSort&order=desc&page=", 1:76
)
jop <- map(jop_urls, safely(extract_harvard), .progress = TRUE)
jop_bind <- jop |>
map('result') |>
compact() |>
bind_rows() |>
mutate(journal = "jop") |>
write_csv("data/jop_replication.csv")
replication <- bind_rows(ajps_bind, apsr_bind, jop_bind) |>
write_csv("data/polsci_replication.csv")
# Replication plot
replication |>
filter(year < 2022) |>
group_by(year, journal) |>
count() |>
ggplot(aes(year, n, color = journal, group = journal)) +
geom_point() +
geom_line() +
theme_light() +
scale_color_viridis_d()