Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
color map or Irish water protests
county population pop
Carlow 54 54000
Cavan 73 73000
Clare 117 117000
Cork 519 519000
Donegal 161 161000
Dublin 1273 1273000
Galway 250 250000
Kerry 145 145000
Kildare 210 210000
Kilkenny 95 95000
Laois 80 80000
Leitrim 31 31000
Limerick 191 191000
Longford 39 39000
Louth 122 122000
Mayo 130 130000
Meath 184 184000
Monaghan 60 60000
Offaly 76 76000
Roscommon 64 64000
Sligo 65 65000
Tipperary 158 158000
Waterford 113 113000
Westmeath 86 86000
Wexford 145 145000
Wicklow 136 136000
library(RColorBrewer)
library(sp)
con <- url("http://gadm.org/data/rda/IRL_adm1.RData")
print(load(con))
close(con)
people<-read.csv('cases2.csv', sep=',', header=TRUE)
#print(people)
pops = cut(people$cases,breaks=c(0,2,4,7,6,10,20,50,100,150))
print(pops)
myPalette<-brewer.pal(9,"Blues")
gadm$pops <-pops
#spplot(gadm, "pops", col.regions=myPalette, main="Water Marchers Per County (1000s)")
#dev.print(file="CFIrl.jpeg", device=jpeg, width=600)
#dev.off()
population<-read.csv('countypopths.csv', sep=',', header=TRUE)
pops = cut(population$population,breaks=c(0,20,40,60,70,80,100,160,400,1300))
myPalette<-brewer.pal(9,"Greens")
gadm$pops <-pops
#spplot(gadm, "pops", col.regions=myPalette, main="Population in thousands",
# lwd=.4, col="black")
#dev.print(file="PopIrl.jpeg", device=jpeg, width=600)
#dev.off()
#gadm$cfpop <- people$cases/(population$population/10)
gadm$cfpop <- ((people$protestors)/ (population$pop))*100
print(gadm$cfpop)
#cfpop = cut(gadm$cfpop,breaks=c(0,0.1,0.2,0.3,0.5,0.75,1,1.5))
cfpop = cut(gadm$cfpop,breaks=c(0,3,4,5,6,8,9,11))
gadm$cfpop <- as.factor(cfpop)
myPalette<-brewer.pal(7,"Purples")
gadm$cfpop <-cfpop
spplot(gadm, "cfpop", col.regions=myPalette, main="Marchers % Population",
lwd=.4, col="black")
#dev.print(file="CFperPopIrl.jpeg", device=jpeg, width=600)
#dev.off()
county cases protestors
Carlow 2 2000
Cavan 0.5 500
Clare 3.2 3200
Cork 24 24000
Donegal 6.6 6600
Dublin 133.8 133800
Galway 21.3 21300
Kerry 3 3000
Kildare 9.6 9600
Kilkenny 2 2000
Laois 2.5 2500
Leitrim 2 2000
Limerick 4.4 4400
Longford 1.5 1500
Louth 13 13000
Mayo 7 7000
Meath 5.7 5700
Monaghan 2 2000
Offaly 3.3 3300
Roscommon 2.2 2200
Sligo 5 5000
Tipperary 5.3 5300
Waterford 6 6000
Westmeath 4.5 4500
Wexford 4 4000
Wicklow 11.5 11500
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment