🤷♂️
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() %>% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(rnoaa) | |
| library(tidyverse) | |
| library(stringr) | |
| library(weathermetrics) | |
| my_token <- "get your own here..." | |
| theme_steve <- function() { | |
| theme_bw() + | |
| theme(panel.border = element_blank(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| War | Date | Casualties | Support | |
|---|---|---|---|---|
| WWII | 1941-12-07 | 2400 | 86 | |
| WWII | 1942-02-01 | 16247 | 87 | |
| WWII | 1943-02-01 | 17899 | 92 | |
| WWII | 1943-09-04 | 24127 | 89 | |
| WWII | 1944-02-02 | 30736 | 77 | |
| WWII | 1946-04-10 | 217000 | 77 | |
| WWII | 1943-03-01 | 20737 | 85.5 | |
| WWII | 1944-05-07 | 36274 | 81 | |
| WWII | 1944-08-30 | 67806 | 82 |
OlderNewer