Skip to content

Instantly share code, notes, and snippets.

@hdigital
hdigital / parlgov-cabinet-duration.R
Created May 3, 2016 09:31
calculate cabinet duration with ParlGov data in R -- two approaches
# get and read ParlGov cabinet data
tbl <- 'view_cabinet.csv'
if( ! tbl %in% list.files()) {
download.file(paste0('http://www.parlgov.org/static/data/development-cp1252/', tbl), tbl)
}
## Base R approach
cab <- read.csv(tbl, fileEncoding = 'cp1252', as.is = TRUE)