-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoups.Rmd
More file actions
423 lines (324 loc) · 16.9 KB
/
coups.Rmd
File metadata and controls
423 lines (324 loc) · 16.9 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
---
title: "Global history of coups and coup attempts"
author: "Katie Thomas"
date: "10 February 2021"
output:
html_document:
keep_md: true
theme: flatly
toc: yes
toc_float: yes
code_fold: hide
editor_options:
chunk_output_type: inline
---
```{r setup, include=FALSE}
#set rmarkdown options
knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE, fig.height = 5, fig.width = 8, attr.output='style="max-height: 350px;"')
#libraries
library(knitr)
library(kableExtra)
library(lubridate)
library(ggmap)
library(sf)
library(ggthemes)
library(mapview)
library(plyr)
library(dplyr)
library(tidyverse)
```
# Dataset
Data come from the Coup D'état Project of the Cline Center for Advanced Social Research at the University of Illinois Urbana-Champaign.
**Peyton, Buddy; Bajjalieh, Joseph; Shalmon, Dan; Martin, Michael; Bonaguro, Jonathan (2021): Cline Center Coup D’état Project Dataset. University of Illinois at Urbana-Champaign. https://doi.org/10.13012/B2IDB-9651987_V2**
This dataset has information from 1945 to 2019 on coups (successful, attempted, or conspired) across the world, as well as data on arrests and the fate of deposed leaders. This project categorizes the 6 Jan 2020 assault on the US Capitol as an "attempted coup" (though it is not in this dataset yet, they have issued a formal statement). According to their website,
>"the objective of the The Coup D'état Project (CDP) is to compile, for 165 countries in the post WWII era, a more comprehensive listing, documentation, and categorization of coups that can be used by researchers. Version 2.0 of the CDP dataset encompasses 943 coup events, including 426 realized coups, 336 attempted coups, and 181 coup conspiracies that occurred between 1945 and 2019."
In terms of categorization of events:
>"The CDP defines coups d'état as organized efforts to effect sudden and irregular (e.g., illegal or extra-legal) removal of the incumbent executive authority of a national government, or to displace the authority of the highest levels of one or more branches of government."
```{r load-data}
# load raw data
coups <- data.frame(read.csv("../dataset_DOI_10.13012:B2IDB-9651987_V2/Coup_Data_v2.0.0.csv", header=TRUE, na.strings=c("", "NA", " ")))
```
## Data summary
First let's see a summary of total number of coups per country (realized, attempted, or conspired) in this dataset for the whole time frame (1945 - 2019) as a scrolling table.
```{r}
#compile number of coups by country and type
counts <- ddply(coups, .(coups$country, coups$event_type), nrow)
#create table column names
names(counts) <- c("Country","Event type","Total 1945-2019")
#generate scrolling table in RMarkdown
kable(counts[ , c("Country","Event type","Total 1945-2019")], caption = "Global coups (including attempted and conspired coups) from 1945-2019.") %>%
kable_styling(full_width = F) %>%
collapse_rows(columns = 1, valign = "top") %>%
scroll_box(height = "500px")
```
The Cline Center data only goes up through 2019, so we should be aware of coups that have occurred since then. However, I do not want to attempt to categorize potential coups according to their guidelines, and would prefer to mention notable events in text if needed rather than alter the dataset.
Some notable events to consider in 2020/2021:
* **9 Feb 2020**: potential coup attempt (may not fit criteria) in El Salvador when President Nayib Bukele used armed soldiers to coerce legislative action.
* **3 May 2020**: attempted (failed) coup in Venezuela to oust Nicolás Maduro
* **18 Aug 2020**: coup in Mali, when President Keita and Prime Minister Cisse resigned while under military arrest and a military junta took power.
* **6 Jan 2021**: attempted (failed) coup at the Capitol in the US.
* **1 Feb 2021**: successful military coup in Myanmar.
## Summary statistics
The Cline Center collects coup data from 165 countries in the post WWII era (some of these countries no longer exist). To understand the prevalence of coups, we can calculate some simple summary statistics.
```{r}
#what percentage countries have coup activity recorded? ----
#total number countries
ncountry <- length(levels(as.factor(coups$country)))
#percentage of countries with activity
p.event <- (ncountry/165)*100
#number countries with attempted coups
nattempt <- length(levels(as.factor(filter(coups, event_type=="attempted")$country)))
#percent countries with attempted coups
p.attempt <- (nattempt/165)*100
#number countries with realized coups
nreal <- length(levels(as.factor(filter(coups, event_type=="coup")$country)))
#percent countries with attempted coups
p.real <- (nreal/165)*100
```
* `r round(p.event, digits = 0)`% or `r ncountry`/165 countries recorded post-WWII have had some sort of coup activity.
* `r round(p.attempt, digits = 0)`% or `r nattempt`/165 countries recorded post-WWII have had an unsuccessful coup attempt.
* `r round(p.real, digits = 0)`% or `r nreal`/165 countries recorded post-WWII have had a realized coup.
***
# Data visualization
## Global coups and coup attempts over time
Here I plot the number of coups, coup attempts, and coup conspiracies per year since WWII.
```{r, fig.height = 8, fig.width=8}
#make dataset with coups per year over time
coups.year <- ddply(coups, .(coups$year, coups$event_type), nrow)
#create column names
colnames(coups.year) <- c("year", "event_type", "total")
#make plot
plot_coups_year <- ggplot(coups.year, aes(x = year, y = total, color = event_type)) +
geom_step(size = 1, alpha = 0.8) +
scale_color_manual(values = c("#173F5F","#3CAEA3","#F48005"),
breaks = c("conspiracy", "attempted", "coup"),
labels = c("Coup conspiracy", "Coup attempt", "Realized coup"),
name = " ") +
labs(x = "Year",
y = "Number of coup events",
title = "Global coups",
subtitle = "\nFrequency of global coup events post WWII (1945-2019)",
caption = "\n\nSource: Cline Center for Advanced Social Research") +
theme_economist_white() +
theme(plot.caption = element_text(hjust = 0),
axis.title.y = element_text(vjust = 5),
axis.title.x = element_text(vjust = -5),
plot.background = element_rect(fill = "white"),
legend.background = element_rect(fill = "white"))
#show plot
plot_coups_year
```
This is useful, but the overlapping traces make it a bit difficult for the viewer to immediately pick out trends.
Alternatively, we could visualize this as a stacked bar chart by year and coup-event type.
```{r fig.height = 7, fig.width = 8}
#make plot
plot_coups_year2 <- ggplot(coups.year, aes(x = as.numeric(year), y = total, fill = factor(event_type, levels=c("conspiracy", "attempted", "coup")))) +
geom_bar(position="stack", stat="identity") +
scale_fill_manual(values = c("#173F5F","#3CAEA3","#F48005"),
breaks = c("conspiracy", "attempted", "coup"),
labels = c("Coup conspiracy", "Coup attempt", "Realized coup"),
name = " ") +
labs(x = "Year",
y = "Number of coup events",
title = "Global coups",
subtitle = "\nFrequency of global coup events post WWII (1945-2019)",
caption = "\n\nSource: Cline Center for Advanced Social Research") +
theme_economist_white() +
theme(plot.caption = element_text(hjust = 0),
axis.title.y = element_text(vjust = 5),
axis.title.x = element_text(vjust = -5),
plot.background = element_rect(fill = "white"),
legend.background = element_rect(fill = "white"),
axis.ticks.length = unit(0.15, "cm")) +
scale_x_continuous(n.breaks = 12) +
scale_y_continuous(expand = c(0, 0), limits = c(0, 37))
#show plot
plot_coups_year2
```
This seems more intuitive to a reader.
***
## Geographic distribution of coups
We can also use this dataset to look at the geographic distribution of coups by country.
### Map shaded by total coup activity
Here I make a map of the world (cropping Antarctica for simplicity) with countries shaded by total number of conspired, attempted, or realized coups.
First, I merge the coup dataset with a global map dataframe available through ggplot2. In this process, I have to identify a few outdated country names and update them to current countries so that they can be plotted simply on the map (e.g. "German Democratic Republic" updated to "Germany" for plotting).
```{r, results = "hide"}
#make simple dataframe of number of any coup-related event per country
coups.place <- ddply(coups, .(coups$country), nrow)
#create column names
colnames(coups.place) <- c("country", "total")
#get world map
map.world <- map_data("world")
#check for country names in dataset that are not matching to world map countries
length(which(!coups.place$country %in% map.world$region))
#list countries that need manually checked in global map
missing <- setdiff(coups.place$country, map.world$region)
missing <- as.data.frame(missing, optional = TRUE, stringsAsFactors = FALSE)
colnames(missing) <- "country" #rename column with dataset country name
missing$map_name <- NA #create empty column for map matches
#manually add in missing names (update to modern-day countries)
missing$map_name[missing$country=="Congo"]<-"Democratic Republic of the Congo"
missing$map_name[missing$country=="Cote d'Ivoire"]<-"Ivory Coast"
missing$map_name[missing$country=="Czechoslovakia"]<-"Czech Republic"
missing$map_name[missing$country=="East Timor"]<-"Timor-Leste"
missing$map_name[missing$country=="Ecudaor"]<-"Ecuador" #spelling error in dataset
missing$map_name[missing$country=="German Democratic Republic"]<-"Germany"
missing$map_name[missing$country== "Kyrgyz Republic"]<-"Kyrgyzstan"
missing$map_name[missing$country== "Republic of Korea"]<-"South Korea"
missing$map_name[missing$country== "Republic of Vietnam"]<-"Vietnam"
missing$map_name[missing$country== "Rumania"]<-"Romania"
missing$map_name[missing$country== "Surinam"]<-"Suriname"
missing$map_name[missing$country== "Trinidad and Tobago"]<-"Trinidad"
missing$map_name[missing$country== "United States of America"]<-"USA"
missing$map_name[missing$country== "USSR"]<-"Russia"
missing$map_name[missing$country== "Yemen Arab Republic"]<-"Yemen"
missing$map_name[missing$country== "Yemen PDR"]<-"Yemen"
#add column to original dataset with map country name
coups.map <- left_join(coups.place, missing, by = "country")
#bring over country names that matched map originally into new column
coups.map <- coups.map %>%
mutate(names = ifelse(is.na(map_name), country, map_name))
#join coup data with map dataset
plot.data <- left_join(map.world, coups.map,by = c("region"="names")) %>%
mutate(num_coups = ifelse(is.na(total), 0, total))
```
Then I can plot the map with countries shaded by the number of coup events that have occurred there since WWII. For this map, I include attempted coups, realized coups, and recognized coup conspiracies (as in stacked bar plot above).
```{r, fig.height=6, fig.width=8}
#plot map with color scale based on number of coups recorded
map_coupsnum <- ggplot() +
geom_polygon(data = plot.data,
aes(x = long, y = lat,
group = group,
fill = total),
color = "white",
size = 0.1) +
scale_fill_gradient(low = "#91b8bd",
high = "#244747",
na.value = "#e6e9ed",
name = "Coup events",
breaks = c(1,13,25,37)) +
labs(title = "Global coups, attempts and conspiracies, 1945-2019",
subtitle = "\nHow common are coups in modern history?",
caption = "Source: Cline Center for Advanced Social Research") +
ylim(-60,100) + #cut off Antarctica
theme_economist_white() + #template theme for The Economist
theme(panel.grid.major=element_blank(),
axis.text.x=element_blank(),
axis.text.y=element_blank(),
axis.ticks=element_blank(),
axis.title.x=element_blank(),
axis.title.y=element_blank(),
axis.line.x = element_blank(),
plot.background = element_blank(),
legend.background = element_blank())
map_coupsnum
```
### Map shaded by realized coups
We can also make a map to show only realized coups (that resulted in a transfer of power).
```{r, fig.height=6, fig.width=8}
#make dataframe of only realized coups
realized <- coups %>% filter(event_type == "coup")
#summarize realized coups by country
realized.place <- realized %>%
group_by(country) %>%
tally(name = "total")
#add column to original dataset with map country name
coups.map2 <- left_join(realized.place, missing, by = "country")
#bring over country names that matched map originally into new column
coups.map2 <- coups.map2 %>%
mutate(names = ifelse(is.na(map_name), country, map_name))
#join coup data with map dataset
plot.data2 <- left_join(map.world, coups.map2,by = c("region"="names")) %>%
mutate(num_coups = ifelse(is.na(total), 0, total)) %>%
mutate(binary = ifelse(is.na(total), "no", "yes"))
#plot map with color scale based on number of realized coups recorded
map_realized <- ggplot() +
geom_polygon(data = plot.data2,
aes(x = long, y = lat,
group = group,
fill = total),
color = "white",
size = 0.15) +
scale_fill_gradient2(low = "#FFE66B",
mid = "#F48005",
high = "#8E1A00",
na.value = "#e6e9ed",
guide = "colourbar",
midpoint = 9,
name = "Realized\ncoups",
breaks = c(1,5,10,16)) +
labs(title = "Global realized coups, 1945-2019",
subtitle = "\nHow common are realized coups in modern history?",
caption = "Source: Cline Center for Advanced Social Research") +
ylim(-60,90) + #cut off Antarctica
theme_economist_white() + #template theme for The Economist
theme(panel.grid.major=element_blank(),
axis.text.x=element_blank(),
axis.text.y=element_blank(),
axis.ticks=element_blank(),
axis.title.x=element_blank(),
axis.title.y=element_blank(),
axis.line.x = element_blank(),
plot.background = element_blank(),
legend.background = element_blank())
map_realized
```
This may be more useful in thinking about where coups have a direct effect on who is in power.
Let's see a table of the number of realized coups by country (from this subset).
```{r}
#order realized coup data by number of coups
counts2 <- realized.place %>%
arrange(desc(total))
#create table column names
names(counts2) <- c("Country","Realized coups 1945-2019")
#generate scrolling table in RMarkdown
kable(counts2[ , c("Country","Realized coups 1945-2019")], caption = "Global realized coups from 1945-2019.") %>%
kable_styling(full_width = F) %>%
collapse_rows(columns = 1, valign = "top") %>%
scroll_box(height = "500px")
```
***
# Construct chart
My final choice for the visualization is the map depicting realized coups around the world and the stacked bar plot showing coup events (planned, attempted, and realized) over time. Here, I plot the stacked bar chart with the map inset on the same panel.
```{r, fig.height = 8, fig.width = 10}
#expand coordinate space of bar chart
plot_coups_year3 <- plot_coups_year2 +
scale_x_continuous(
breaks=c(1950,1960,1970,1980,1990,2000,2010,2020,2070),
labels=c("1950","1960","1970","1980","1990","2000","2010","2020"," "),
expand=c(0,0.05),
limits=c(1944, 2060))
#make map have transparent background and no titles
map_realized2 <- map_realized +
theme(panel.background = element_rect(fill = "transparent", colour = NA),
plot.background = element_rect(fill = "transparent", colour = NA),
legend.position = c(0.6, 0.1),
legend.direction = "horizontal",
legend.key.size = unit(0.4, "cm"),
legend.text=element_text(size=11)) +
labs(title = "", subtitle = "", caption = "")
#plot with inset
plots2 <- plot_coups_year3 +
labs(subtitle = "\nFrequency and geographic distribution of coup events, 1945-2019") +
theme(legend.position = c(0.1,0.9),
legend.direction = "vertical",
legend.key.size = unit(0.3, "cm"),
panel.border = element_blank(),
axis.line = element_line(),
legend.text = element_text(size=12)) +
xlab("Year ") +
#block out grid lines under map
geom_rect(xmin = 1985, xmax = 2060, ymin = 29, ymax = 31, fill = "white") +
geom_rect(xmin = 2000, xmax = 2060, ymin = 19, ymax = 21, fill = "white") +
geom_rect(xmin = 2020, xmax = 2060, ymin = 9, ymax = 11, fill = "white") +
#add map plot
annotation_custom(ggplotGrob(map_realized2), xmin = 1980, xmax = 2065, ymin = 8, ymax = 40)
#show plot
plots2
```
```{r, results = "hide"}
#export this plot
pdf("../chart_KateThomas.pdf", width=10, height=8)
plots2
dev.off()
```