This file contains 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 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(MASS) | |
library(rio) | |
library(tidyverse) | |
multhet <- function(y, ## = formula(1~1), | |
v, ## = formula(~1), | |
data) { | |
## check length of inputs | |
if (class(y) != "formula") { |
This file contains 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
################################################################################ | |
# | |
# ikashnitsky.github.io 2017-07-18 | |
# Accessing Eurostat data using the `eurostat` R package | |
# Young people neither in employment nor in education and training in Europe | |
# Ilya Kashnitsky, [email protected] | |
# | |
################################################################################ | |
# Erase all objects in memory |
This file contains 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
################################################################################ | |
# | |
# ikashnitsky.github.io 2017-06-30 | |
# Produce an RGB coded map of pop structures at NUTS-3 level | |
# Ilya Kashnitsky, [email protected] | |
# | |
################################################################################ | |
# Erase all objects in memory | |
rm(list = ls(all = TRUE)) |
This file contains 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) | |
### Make sure to download files from www.parlgov.org! | |
elec <- read.csv("view_election.csv") | |
cab <- read.csv("view_cabinet.csv") | |
party <- read.csv("view_party.csv") | |
### Date | |
cab$start_date <- as.Date(cab$start_date) |
This file contains 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(httr) | |
adresse <- "8 bd du port" | |
resultraw <- httr::GET(utils::URLencode(paste0('https://api-adresse.data.gouv.fr/search/?q=', adresse))) | |
result <-jsonlite::fromJSON(httr::content(resultraw, "text")) | |
result$features |
This file contains 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(foreign) ## for data import | |
library(dplyr) ## for chaining ops together | |
library(ggplot2) ## for plotting | |
library(reshape2) ## for reshaping | |
library(hrbrthemes) ## for pretty pictures | |
library(survey) ## for... uh, survey data | |
party.colours <- c("#0087DC","#D50000","#FDBB30","#FFFF00","#008142","#99CC33","#70147A","#DDDDDD") | |
bes <- read.spss("~/Dropbox/2017-forecasting/data/individual/BES2015_W10_Panel_v0.3.sav") |
This file contains 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(sp) | |
library(raster) | |
library(rgeos) | |
## import des données | |
download.file(url = "http://biogeo.ucdavis.edu/data/gadm2.8/rds/GBR_adm2.rds", | |
destfile = file.path(tempdir(), "GBR_adm2.rds")) | |
download.file(url = "http://biogeo.ucdavis.edu/data/gadm2.8/rds/IRL_adm0.rds", | |
file.path(tempdir(),"IRL_adm0.rds")) |
This file contains 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(boot) | |
r2 = function(f, d, i) { | |
d = d[i, ] | |
f = lm(f, data = d) | |
return(summary(f)$r.square) | |
} | |
br <- boot(COI, r2, 10000, formula = nb.publis ~ nb.liens) | |
br | |
plot(br) | |
boot.ci(br, .95, "bca") |
This file contains 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
## Please note, this script is entirely derivative of work done | |
## by Simon Jackman for his article `Pooling the Polls...' | |
## Aust. J. Pol. Science, 40(4): 499-517 | |
## Libraries | |
library(reshape) | |
library(rjags) | |
library(R2WinBUGS) | |
library(ggplot2) | |
library(scales) |