| ̄ ̄ ̄ ̄ ̄  ̄| | DEATH | | IS | | INEVITABLE | | _______| (__/) || (•ㅅ•) || / づ
(・_・)っ
| library(tidyverse) | |
| States <- read_csv("~/Dropbox/data/COW/states/states2011.csv") | |
| # Create a PDF of state-years. ---------- | |
| # States data nominally end in 2011, so let's fudge that. | |
| States %>% | |
| mutate(endyear = ifelse(endyear == 2011, 2015, endyear)) %>% | |
| rowwise() %>% |
| library(tidyverse) | |
| library(stringr) | |
| # Freedom of the Press data --------- | |
| # Oh god, Freedom House, why the sam hell do you do these things... | |
| FP <- readxl::read_excel("~/Dropbox/data/freedom-house/FOTP1980-FOTP2017_Public-Data.xlsx", sheet=2) %>% | |
| repair_names() | |
| # Ugh, all right. Let's do this... |
| setwd("~/Dropbox/projects/blog-posts/nato-spending") | |
| library(WDI) | |
| library(countrycode) | |
| library(tidyverse) | |
| Milit <- WDI(country="all", indicator=c("MS.MIL.XPND.GD.ZS", "MS.MIL.XPND.ZS","MS.MIL.TOTL.P1", "SP.POP.TOTL"), | |
| start=1988, end=2015) %>% | |
| rename(milex = MS.MIL.XPND.GD.ZS, milgovexp = MS.MIL.XPND.ZS, | |
| milper = MS.MIL.TOTL.P1, tpop = SP.POP.TOTL) %>% tbl_df() %>% |
| library(RCurl) | |
| library(tidyverse) | |
| library(maps) | |
| # library(fiftystater) | |
| theme_steve <- function() { | |
| theme_bw() + | |
| theme(panel.border = element_blank(), | |
| plot.caption=element_text(hjust=1, size=9, | |
| margin=margin(t=10), |
| # You won't need all of these packages. I just copied it from another,related analysis: | |
| # https://github.com/svmiller/etjc | |
| library(car) | |
| library(arm) | |
| library(countrycode) | |
| library(data.table) | |
| library(tidyverse) | |
| library(sqldf) | |
| # library(pdftools) |
| library(rnoaa) | |
| library(tidyverse) | |
| library(stringr) | |
| library(weathermetrics) | |
| my_token <- "get your own here..." | |
| theme_steve <- function() { | |
| theme_bw() + | |
| theme(panel.border = element_blank(), |
| library(tidyverse) | |
| library(lubridate) # just in case I need to manipulate a date | |
| library(stringr) # just in case I need to manipulated a string | |
| library(stevemisc) # for my personal theme | |
| library(scales) # just in case I need to fudge a y-axis to be a scale | |
| library(knitr) # just in case I need a markdown table | |
| # I'm going to assume you have Fariss' data downloaded somewhere. Here's what mine looks like. | |
| LHR <- read_csv("~/Dropbox/data/latent-human-rights/HumanRightsProtectionScores_v2.04.csv") |
| ̄ ̄ ̄ ̄ ̄  ̄| | DEATH | | IS | | INEVITABLE | | _______| (__/) || (•ㅅ•) || / づ
(・_・)っ
| library(tidyverse) | |
| library(stevemisc) | |
| # Load data | |
| Non <- read_csv("~/Dropbox/data/cow/wars/Non-StateWarData_v4.0.csv") | |
| Intra <- read_csv("~/Dropbox/data/cow/wars/Intra-StateWarData_v4.1.csv") | |
| Inter <- read_csv("~/Dropbox/data/cow/wars/Inter-StateWarData_v4.0.csv") | |
| Extra <- read_csv("~/Dropbox/data/cow/wars/Extra-StateWarData_v4.0.csv") |
| library(rvest) | |
| library(lubridate) | |
| library(tidyverse) | |
| Truman <- read_html("http://www.presidency.ucsb.edu/data/popularity.php?pres=33") | |
| Truman %>% | |
| html_table(fill=T) -> Truman | |
| Truman[[11]] -> Truman |