Skip to content

Instantly share code, notes, and snippets.

View datagistips's full-sized avatar

mathieu rajerison datagistips

View GitHub Profile
@datagistips
datagistips / heatmap_candidats_profession.R
Created June 13, 2012 05:43
HeatMap Profession des candidats aux législatives et Parti
library(gdata)
library(reshape)
library(classInt)
###############
# INTEGRATING #
###############
f <- read.xls("IN/Leg 2012 Candidatures T1 31 05 2012.xls", sheet=1)
nuances <- read.xls("IN/Leg 2012 Candidatures T1 31 05 2012.xls", sheet=2, skip=2, header=FALSE)
@datagistips
datagistips / Isarithmic_Choropleth-election_results.R
Created June 4, 2012 12:40
Isarithmic Choropleth - election results
library(rgdal)
# DATA
# http://professionnels.ign.fr/ficheProduitCMS.do?idDoc=6185461
cities <- readOGR("C:/DATAS/GEOFLA/COMMUNES/COMMUNE.SHP", "COMMUNE")
# http://www.data-publica.com/opendata/13495--resultats-du-deuxieme-tour-de-l-election-presidentielle-2012
votes <- read.csv2("IN/votesResults2012.csv",sep=",", quote="\"")
# VOTES TO SPATIAL DATA "
votes$pc.sar <- votes$results.sarkozy / votes$results.exprimes
@datagistips
datagistips / elections_distance_coast.R
Created June 2, 2012 07:59
Elections : votes and distance to the coast
## ATTENTION !!: l'utilisation de ce code nécessite d'avoir
# lancé le code précédent (https://gist.github.com/2857180) ,
# en gros d'avoir créé l'objet spatial comm2 avec les résultats du vote.
library(rgdal)
library(spatstat)
library(maptools)
## COERCING DATA for SPATSTAT ##
# on lit le trait de côte téléchargé depuis
@datagistips
datagistips / election_choropleth.R
Created June 2, 2012 07:51
Elections Simple Choropleth
library(rgdal)
library(maptools)
library(classInt)
setwd("F:/METHODES/1205_CAMPAGNE_PRES")
#########################
## READING SOURCE DATA ##
#########################
# on intègre les contours des communes GEOFLA