Last active
February 8, 2016 09:39
-
-
Save Contrastat/156f026db87aaa4162ba to your computer and use it in GitHub Desktop.
Project for Udacity Visualization
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(ggplot2) | |
library(tidyr) | |
library(dplyr) | |
library(RColorBrewer) | |
library(GGally) | |
library(scales) | |
library(memisc) | |
library(gridExtra) | |
library(reshape2) | |
library(data.table) | |
select <- dplyr::select | |
#setwd('C:/Users/federico/Documents/Potencials Avaluacions/Blog/EPA/') | |
setwd('/Volumes/KINGSTON/D3JS/Unemployment/') | |
inicio = 2005 | |
fin = 2015 | |
#Fase uno: generamos los valores para cada anyo | |
for (j in seq(inicio,fin)){ | |
epa.fixed <- read.fwf(paste(paste("datos_t4", toString(j), sep = ""), ".txt", sep = ""), width = c(3,2,2,5,1,2,2,1,1,2,2,2,1,1,2,3,1,3,2,2,2,3,1,2,1,2,3,2,1,1,1,2,2,1,1,1,2,1,1,1,2,2,2,3,3,2,3,1,2,4,4,4,1,4,4,2,1,1,1,2,4,1,1,2,2,1,1,1,1,2,1,1,2,1,1,1,3,1,1,2,1,2,2,2,1,1,1,2,3,1,2,2,7)) | |
dimnames(epa.fixed)[[2]] <- c("CICLO","CCAA","PROV","NVIVI","NIVEL","NPERS","EDAD5","RELPP1","SEXO1","NCONY","NPADRE","NMADRE","RELLMILI","ECIV1","PRONA1","REGNA1","NAC1","EXREGNA1","ANORE1","NFORMA","RELLB1","EDADEST","CURSR","NCURSR","CURSNR","NCURNR","HCURNR","RELLB2","TRAREM","AYUDFA","AUSENT","RZNOTB","VINCUL","NUEVEM","OCUP1","ACT1","SITU","SP","DUCON1","DUCON2","DUCON3","TCONTM","TCONTD","DREN","DCOM","PROEST","REGEST","PARCO1","PARCO2","HORASP","HORASH","HORASE","EXTRA","EXTPAG","EXTNPG","RZDIFH","TRAPLU","OCUPLU1","ACTPLU1","SITPLU","HORPLU","MASHOR","DISMAS","RZNDISH","HORDES","BUSOTR","BUSCA","DESEA","FOBACT","NBUSCA","ASALA","EMBUS","ITBU","DISP","RZNDIS","EMPANT","DTANT","OCUPA","ACTA","SITUA","OFEMP","SIDI1","SIDI2","SIDI3","SIDAC1","SIDAC2","MUN1","PRORE1","REPAIRE1","TRAANT","AOI","CSE","FACTOREL") | |
dim(epa.fixed) | |
names(epa.fixed) | |
str(epa.fixed) | |
# table(epa.fixed$EDAD5) | |
epa.fixed$provincia <- factor(epa.fixed$PROV) | |
epa.fixed$ccaa <- factor(epa.fixed$CCAA) | |
#Atur | |
epa.fixed$actiu <- ifelse((epa.fixed$AOI == 3) | (epa.fixed$AOI == 4) | (epa.fixed$AOI == 5) | (epa.fixed$AOI == 6), 1,0) | |
epa.fixed$aturat <- ifelse((epa.fixed$AOI == 5) | (epa.fixed$AOI == 6),1,0) | |
epa.fixed$actiu2 <- ifelse((epa.fixed$AOI == 3) | (epa.fixed$AOI == 4) | (epa.fixed$AOI == 5) | (epa.fixed$AOI == 6) | (epa.fixed$AOI == 7), 1,0) | |
epa.fixed$aturat2 <- ifelse((epa.fixed$AOI == 5) | (epa.fixed$AOI == 6) | (epa.fixed$AOI == 7),1,0) | |
epa.fixed$aturvllarg <- ifelse(epa.fixed$aturat == 1 & (epa.fixed$ITBU == 7 | epa.fixed$ITBU == 8),1,0) | |
epa.fixed$aturllarg <- ifelse((epa.fixed$aturat == 1) & ((epa.fixed$ITBU == 7) | (epa.fixed$ITBU == 8) | (epa.fixed$ITBU == 5) | (epa.fixed$ITBU == 6)),1,0) | |
epa.fixed$home <- ifelse((epa.fixed$SEXO == 1),1,0) | |
epa.fixed$Educ1 <- ifelse((epa.fixed$NFORMA == "AN") | (epa.fixed$NFORMA == "P1") | (epa.fixed$NFORMA == "P2") | (epa.fixed$NFORMA == "S1"), 1, 0) | |
epa.fixed$Educ2 <- ifelse((epa.fixed$NFORMA == "SG") | (epa.fixed$NFORMA == "SP"), 1, 0) | |
epa.fixed$Educ3 <- ifelse((epa.fixed$NFORMA == "SU"), 1, 0) | |
epa.fixed$jove <- ifelse((epa.fixed$EDAD5 == 16 | epa.fixed$EDAD5 == 20 | epa.fixed$EDAD5 == 25),1,0) | |
epa.fixed$gran <- ifelse((epa.fixed$EDAD5 == 45 | epa.fixed$EDAD5 == 50 | epa.fixed$EDAD5 == 55 | epa.fixed$EDAD5 == 60),1,0) | |
epa.fixed$noef <- ifelse((epa.fixed$CURSR == 3 & epa.fixed$CURSNR == 3 & (epa.fixed$AOI == 5 | epa.fixed$AOI == 6 | epa.fixed$AOI == 7 | epa.fixed$AOI == 8 | epa.fixed$AOI == 9) & (epa.fixed$EDAD5 == 16 | epa.fixed$EDAD5 == 20 | epa.fixed$EDAD5 == 25)),1,0) | |
epa.fixed$noefvul <- ifelse((epa.fixed$noef == 1 & epa.fixed$Educ1 == 1),1,0) | |
epa.fixed$ocupado <- ifelse((epa.fixed$AOI == 3 | epa.fixed$AOI == 4),1,0) | |
epa.fixed$emppub <- ifelse((epa.fixed$ocupado == 1 & epa.fixed$SITU == 8),1,0) | |
y = 2005 | |
for (i in seq(133, 173, 4)){ | |
if (epa.fixed$CICLO == i){ | |
epa.fixed$year <- y | |
} | |
y = y + 1 | |
} | |
desocupats.prov <- epa.fixed %>% | |
filter(!is.na(AOI)) %>% | |
mutate(aturjove = aturat * jove, | |
aturgran = aturat * gran, | |
atureso = aturat * Educ1, | |
aturpost = aturat * Educ2, | |
aturuniv = aturat * Educ3, | |
aturhome = aturat * home, | |
joveactiu = jove * actiu, | |
homeactiu = home * actiu, | |
donaactiu = (1-home) * actiu, | |
esoactiu = Educ1 * actiu, | |
postactiu = Educ2 * actiu, | |
univactiu = Educ3 * actiu, | |
aturdona = aturat * (1-home))%>% | |
group_by(provincia) %>% | |
summarise(year = mean(year), | |
Actius = sum(actiu * FACTOREL/100), | |
Aturats = sum(aturat * FACTOREL/100), | |
AturatsLlT = sum(aturllarg * FACTOREL/100), | |
AturatsVLlT = sum(aturvllarg * FACTOREL/100), | |
Joves = sum(joveactiu * FACTOREL/100), | |
Joves2 = sum(jove * FACTOREL/100), | |
Grans = sum(gran * FACTOREL/100), | |
Homes = sum(homeactiu * FACTOREL/100), | |
Dones = sum(donaactiu * FACTOREL/100), | |
Aturat.Joves = sum(aturjove * FACTOREL/100), | |
Aturat.Grans = sum(aturgran * FACTOREL/100), | |
Aturat.Eso = sum(atureso * FACTOREL/100), | |
Aturat.Post = sum(aturpost * FACTOREL/100), | |
Aturat.Univ = sum(aturuniv * FACTOREL/100), | |
Aturat.Homes = sum(aturhome * FACTOREL/100), | |
Aturat.Dones = sum(aturdona * FACTOREL/100), | |
EsoMenys = sum(esoactiu * FACTOREL/100), | |
PostObl = sum(postactiu * FACTOREL/100), | |
Univ = sum(univactiu * FACTOREL/100), | |
Noefs = sum(noef * FACTOREL/100), | |
Noefs.Vul = sum(noefvul * FACTOREL/100), | |
Ocupados = sum(ocupado * FACTOREL/100), | |
Emp.publicos = sum(emppub * FACTOREL/100), | |
obs = sum(FACTOREL/100), | |
n = n())%>% | |
mutate(tasa.atur = Aturats/Actius * 100, | |
tasa.aturvlt = AturatsVLlT/Actius * 100, | |
tasa.aturjove = Aturat.Joves / Joves * 100, | |
tasa.jovesaturats = Aturat.Joves / Aturats * 100, | |
tasa.aturgran = Aturat.Grans / Grans * 100, | |
tasa.gransaturats = Aturat.Grans / Aturats * 100, | |
tasa.atureso = Aturat.Eso / EsoMenys * 100, | |
tasa.esoaturats = Aturat.Eso / Aturats * 100, | |
tasa.aturpost = Aturat.Post / PostObl * 100, | |
tasa.postaturats = Aturat.Post / Aturats * 100, | |
tasa.aturuniv = Aturat.Univ / Univ * 100, | |
tasa.univaturats = Aturat.Univ / Aturats * 100, | |
tasa.aturdona = Aturat.Dones / Dones * 100, | |
tasa.donaaturtats = Aturat.Dones / Aturats * 100, | |
tasa.aturhome = Aturat.Dones / Homes * 100, | |
tasa.homeaturats = Aturat.Homes / Aturats * 100, | |
tasa.noefs = Noefs / Joves2 * 100, | |
tasa.noefsvul = Noefs.Vul / Joves2 * 100, | |
tasa.publico = Emp.publicos / Ocupados * 100) %>% | |
arrange(provincia) | |
desocupats.ccaa <- epa.fixed %>% | |
filter(!is.na(AOI)) %>% | |
mutate(aturjove = aturat * jove, | |
aturgran = aturat * gran, | |
atureso = aturat * Educ1, | |
aturpost = aturat * Educ2, | |
aturuniv = aturat * Educ3, | |
aturhome = aturat * home, | |
joveactiu = jove * actiu, | |
homeactiu = home * actiu, | |
donaactiu = (1-home) * actiu, | |
esoactiu = Educ1 * actiu, | |
postactiu = Educ2 * actiu, | |
univactiu = Educ3 * actiu, | |
aturdona = aturat * (1-home))%>% | |
group_by(ccaa) %>% | |
summarise(year = mean(year), | |
Actius = sum(actiu * FACTOREL/100), | |
Aturats = sum(aturat * FACTOREL/100), | |
AturatsLlT = sum(aturllarg * FACTOREL/100), | |
AturatsVLlT = sum(aturvllarg * FACTOREL/100), | |
Joves = sum(joveactiu * FACTOREL/100), | |
Joves2 = sum(jove * FACTOREL/100), | |
Grans = sum(gran * FACTOREL/100), | |
Homes = sum(homeactiu * FACTOREL/100), | |
Dones = sum(donaactiu * FACTOREL/100), | |
Aturat.Joves = sum(aturjove * FACTOREL/100), | |
Aturat.Grans = sum(aturgran * FACTOREL/100), | |
Aturat.Eso = sum(atureso * FACTOREL/100), | |
Aturat.Post = sum(aturpost * FACTOREL/100), | |
Aturat.Univ = sum(aturuniv * FACTOREL/100), | |
Aturat.Homes = sum(aturhome * FACTOREL/100), | |
Aturat.Dones = sum(aturdona * FACTOREL/100), | |
EsoMenys = sum(esoactiu * FACTOREL/100), | |
PostObl = sum(postactiu * FACTOREL/100), | |
Univ = sum(univactiu * FACTOREL/100), | |
Noefs = sum(noef * FACTOREL/100), | |
Noefs.Vul = sum(noefvul * FACTOREL/100), | |
Ocupados = sum(ocupado * FACTOREL/100), | |
Emp.publicos = sum(emppub * FACTOREL/100), | |
obs = sum(FACTOREL/100), | |
n = n())%>% | |
mutate(tasa.atur = Aturats/Actius * 100, | |
tasa.aturvlt = AturatsVLlT/Actius * 100, | |
tasa.aturjove = Aturat.Joves / Joves * 100, | |
tasa.jovesaturats = Aturat.Joves / Aturats * 100, | |
tasa.aturgran = Aturat.Grans / Grans * 100, | |
tasa.gransaturats = Aturat.Grans / Aturats * 100, | |
tasa.atureso = Aturat.Eso / EsoMenys * 100, | |
tasa.esoaturats = Aturat.Eso / Aturats * 100, | |
tasa.aturpost = Aturat.Post / PostObl * 100, | |
tasa.postaturats = Aturat.Post / Aturats * 100, | |
tasa.aturuniv = Aturat.Univ / Univ * 100, | |
tasa.univaturats = Aturat.Univ / Aturats * 100, | |
tasa.aturdona = Aturat.Dones / Dones * 100, | |
tasa.donaaturtats = Aturat.Dones / Aturats * 100, | |
tasa.aturhome = Aturat.Dones / Homes * 100, | |
tasa.homeaturats = Aturat.Homes / Aturats * 100, | |
tasa.noefs = Noefs / Joves2 * 100, | |
tasa.noefsvul = Noefs.Vul / Joves2 * 100, | |
tasa.publico = Emp.publicos / Ocupados * 100) %>% | |
arrange(ccaa) | |
desocupats.nac <- epa.fixed %>% | |
filter(!is.na(AOI)) %>% | |
mutate(aturjove = aturat * jove, | |
aturgran = aturat * gran, | |
atureso = aturat * Educ1, | |
aturpost = aturat * Educ2, | |
aturuniv = aturat * Educ3, | |
aturhome = aturat * home, | |
joveactiu = jove * actiu, | |
homeactiu = home * actiu, | |
donaactiu = (1-home) * actiu, | |
esoactiu = Educ1 * actiu, | |
postactiu = Educ2 * actiu, | |
univactiu = Educ3 * actiu, | |
aturdona = aturat * (1-home))%>% | |
summarise(year = mean(year), | |
Actius = sum(actiu * FACTOREL/100), | |
Aturats = sum(aturat * FACTOREL/100), | |
AturatsLlT = sum(aturllarg * FACTOREL/100), | |
AturatsVLlT = sum(aturvllarg * FACTOREL/100), | |
Joves = sum(joveactiu * FACTOREL/100), | |
Joves2 = sum(jove * FACTOREL/100), | |
Grans = sum(gran * FACTOREL/100), | |
Homes = sum(homeactiu * FACTOREL/100), | |
Dones = sum(donaactiu * FACTOREL/100), | |
Aturat.Joves = sum(aturjove * FACTOREL/100), | |
Aturat.Grans = sum(aturgran * FACTOREL/100), | |
Aturat.Eso = sum(atureso * FACTOREL/100), | |
Aturat.Post = sum(aturpost * FACTOREL/100), | |
Aturat.Univ = sum(aturuniv * FACTOREL/100), | |
Aturat.Homes = sum(aturhome * FACTOREL/100), | |
Aturat.Dones = sum(aturdona * FACTOREL/100), | |
EsoMenys = sum(esoactiu * FACTOREL/100), | |
PostObl = sum(postactiu * FACTOREL/100), | |
Univ = sum(univactiu * FACTOREL/100), | |
Noefs = sum(noef * FACTOREL/100), | |
Noefs.Vul = sum(noefvul * FACTOREL/100), | |
Ocupados = sum(ocupado * FACTOREL/100), | |
Emp.publicos = sum(emppub * FACTOREL/100), | |
obs = sum(FACTOREL/100), | |
n = n())%>% | |
mutate(tasa.atur = Aturats/Actius * 100, | |
tasa.aturvlt = AturatsVLlT/Actius * 100, | |
tasa.aturjove = Aturat.Joves / Joves * 100, | |
tasa.jovesaturats = Aturat.Joves / Aturats * 100, | |
tasa.aturgran = Aturat.Grans / Grans * 100, | |
tasa.gransaturats = Aturat.Grans / Aturats * 100, | |
tasa.atureso = Aturat.Eso / EsoMenys * 100, | |
tasa.esoaturats = Aturat.Eso / Aturats * 100, | |
tasa.aturpost = Aturat.Post / PostObl * 100, | |
tasa.postaturats = Aturat.Post / Aturats * 100, | |
tasa.aturuniv = Aturat.Univ / Univ * 100, | |
tasa.univaturats = Aturat.Univ / Aturats * 100, | |
tasa.aturdona = Aturat.Dones / Dones * 100, | |
tasa.donaaturtats = Aturat.Dones / Aturats * 100, | |
tasa.aturhome = Aturat.Dones / Homes * 100, | |
tasa.homeaturats = Aturat.Homes / Aturats * 100, | |
tasa.noefs = Noefs / Joves2 * 100, | |
tasa.noefsvul = Noefs.Vul / Joves2 * 100, | |
tasa.publico = Emp.publicos / Ocupados * 100) | |
desocupats.nac$ccaa = factor("Agregado") | |
desocupats.ccaa = rbind(desocupats.ccaa, desocupats.nac) | |
drops <- c("ccaa") | |
desocupats.nac <- desocupats.nac[,!(names(desocupats.nac) %in% drops)] | |
desocupats.nac$provincia = factor("Agregado") | |
desocupats.prov = rbind(desocupats.prov, desocupats.nac) | |
drops <- c("provincia") | |
desocupats.nac <- desocupats.nac[,!(names(desocupats.nac) %in% drops)] | |
desocupats.ccaa$ccaa <- factor(desocupats.ccaa$ccaa, | |
levels = c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,51,52,"Agregado"), | |
labels = c("Andalucia", "Aragon", "Asturias", "Baleares", "Canarias", "Cantabria", "Castilla-Leon", "Castilla-La Mancha", "Catalunya", "Comunitat Valenciana", "Extremadura", "Galicia", "Madrid", "Murcia", "Navarra", "Pais Vasco", "La Rioja", "Ceuta", "Melilla", "Espanya")) | |
desocupats.ccaa$auxccaa <- as.numeric(desocupats.ccaa$ccaa) | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==1] <- 1 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==2]<-2 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==6]<-3 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==8]<-4 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==7]<-5 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==9]<-6 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==18]<-7 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==13]<-8 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==15]<-9 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==10]<-10 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==11]<-11 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==12]<-12 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==4]<-13 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==5]<-14 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==17]<-15 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==16]<-16 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==3]<-17 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==14]<-18 | |
desocupats.ccaa$id2[desocupats.ccaa$auxccaa==20]<-20 | |
desocupats.prov$provincia <- factor(desocupats.prov$provincia, | |
levels = c(seq(1,52),"Agregado"), | |
labels = c("Alava", "Albacete", "Alicante", "Almeria", "Avila", "Badajoz", "Baleares", "Barcelona", "Burgos", "Caceres", "Cadiz", "Castellon", "Ciudad Real", "Cordoba", "La Coruna", "Cuenca", "Girona", "Granada", "Guadalajara", "Guipuzcoa", "Huelva", "Huesca", "Jaen", "Leon", "Lleida", "La Rioja", "Lugo", "Madrid", "Malaga", "Murcia", "Navarra", "Orense", "Asturias", "Palencia", "Las Palmas", "Pontevedra", "Salamanca", "Santa Cruz de Tenerife", "Cantabria", "Segovia", "Sevilla", "Soria", "Tarragona", "Teruel", "Toledo", "Valencia", "Valladolid", "Vizcaya", "Zamora", "Zaragoza", "Ceuta", "Melilla", "Espanya")) | |
desocupats.prov$auxprov <- as.numeric(desocupats.prov$prov) | |
desocupats.prov$id2[desocupats.prov$auxprov==15]<-40 | |
desocupats.prov$id2[desocupats.prov$auxprov==1]<-48 | |
desocupats.prov$id2[desocupats.prov$auxprov==2]<-13 | |
desocupats.prov$id2[desocupats.prov$auxprov==3]<-35 | |
desocupats.prov$id2[desocupats.prov$auxprov==4]<-1 | |
desocupats.prov$id2[desocupats.prov$auxprov==33]<-51 | |
desocupats.prov$id2[desocupats.prov$auxprov==5]<-18 | |
desocupats.prov$id2[desocupats.prov$auxprov==6]<-38 | |
desocupats.prov$id2[desocupats.prov$auxprov==7]<-44 | |
desocupats.prov$id2[desocupats.prov$auxprov==8]<-27 | |
desocupats.prov$id2[desocupats.prov$auxprov==9]<-19 | |
desocupats.prov$id2[desocupats.prov$auxprov==10]<-39 | |
desocupats.prov$id2[desocupats.prov$auxprov==11]<-2 | |
desocupats.prov$id2[desocupats.prov$auxprov==39]<-12 | |
desocupats.prov$id2[desocupats.prov$auxprov==12]<-36 | |
desocupats.prov$id2[desocupats.prov$auxprov==51]<-31 | |
desocupats.prov$id2[desocupats.prov$auxprov==13]<-14 | |
desocupats.prov$id2[desocupats.prov$auxprov==14]<-3 | |
desocupats.prov$id2[desocupats.prov$auxprov==16]<-15 | |
desocupats.prov$id2[desocupats.prov$auxprov==17]<-28 | |
desocupats.prov$id2[desocupats.prov$auxprov==18]<-4 | |
desocupats.prov$id2[desocupats.prov$auxprov==19]<-16 | |
desocupats.prov$id2[desocupats.prov$auxprov==20]<-49 | |
desocupats.prov$id2[desocupats.prov$auxprov==21]<-5 | |
desocupats.prov$id2[desocupats.prov$auxprov==22]<-9 | |
desocupats.prov$id2[desocupats.prov$auxprov==23]<-6 | |
desocupats.prov$id2[desocupats.prov$auxprov==26]<-47 | |
desocupats.prov$id2[desocupats.prov$auxprov==35]<-45 | |
desocupats.prov$id2[desocupats.prov$auxprov==24]<-20 | |
desocupats.prov$id2[desocupats.prov$auxprov==25]<-29 | |
desocupats.prov$id2[desocupats.prov$auxprov==27]<-41 | |
desocupats.prov$id2[desocupats.prov$auxprov==28]<-33 | |
desocupats.prov$id2[desocupats.prov$auxprov==29]<-7 | |
desocupats.prov$id2[desocupats.prov$auxprov==52]<-32 | |
desocupats.prov$id2[desocupats.prov$auxprov==30]<-52 | |
desocupats.prov$id2[desocupats.prov$auxprov==31]<-34 | |
desocupats.prov$id2[desocupats.prov$auxprov==32]<-42 | |
desocupats.prov$id2[desocupats.prov$auxprov==34]<-21 | |
desocupats.prov$id2[desocupats.prov$auxprov==36]<-43 | |
desocupats.prov$id2[desocupats.prov$auxprov==37]<-22 | |
desocupats.prov$id2[desocupats.prov$auxprov==38]<-46 | |
desocupats.prov$id2[desocupats.prov$auxprov==40]<-23 | |
desocupats.prov$id2[desocupats.prov$auxprov==41]<-8 | |
desocupats.prov$id2[desocupats.prov$auxprov==42]<-24 | |
desocupats.prov$id2[desocupats.prov$auxprov==43]<-30 | |
desocupats.prov$id2[desocupats.prov$auxprov==44]<-10 | |
desocupats.prov$id2[desocupats.prov$auxprov==45]<-17 | |
desocupats.prov$id2[desocupats.prov$auxprov==46]<-37 | |
desocupats.prov$id2[desocupats.prov$auxprov==47]<-25 | |
desocupats.prov$id2[desocupats.prov$auxprov==48]<-50 | |
desocupats.prov$id2[desocupats.prov$auxprov==49]<-26 | |
desocupats.prov$id2[desocupats.prov$auxprov==50]<-11 | |
desocupats.prov$id2[desocupats.prov$auxprov==53]<-53 | |
write.csv(desocupats.ccaa, file = paste(paste("aturCCAA-",toString(j),sep = ""), ".csv", sep = "")) | |
write.csv(desocupats.prov, file = paste(paste("aturProv-",toString(j),sep = ""), ".csv", sep = "")) | |
} | |
##Fase dos: Agarramos las tablas de cada anyo y las juntamos | |
aux <- lapply(Sys.glob("aturCCAA-*.csv"), read.csv) | |
aturCCAA <-aux[[1]] | |
for (j in seq(2,(fin - inicio + 1))){ | |
aturCCAA <- rbind(aturCCAA, aux[[j]]) | |
} | |
write.csv(aturCCAA, file = "aturCCAA.csv") | |
aux <- lapply(Sys.glob("aturProv-*.csv"), read.csv) | |
aturProv <-aux[[1]] | |
for (j in seq(2,fin - inicio + 1)){ | |
aturProv <- rbind(aturProv, aux[[j]]) | |
} | |
write.csv(aturProv, file = "aturProv.csv") | |
###Leemos el csv y con spread lo transformamos para que sea utilizable con las barras. | |
aturCCAA <- read.csv("aturCCAA.csv", header = TRUE, sep = ",", quote = "\"", | |
dec = ".", fill = TRUE, comment.char = "") | |
#sels <- c("year", "ccaa", "tasa.atur") | |
#aturCCAA <- aturCCAA[,(names(aturCCAA) %in% sels)] | |
tasa.aturCCAA <- aturCCAA %>% | |
select(ccaa, year, tasa.atur) %>% | |
spread(year, tasa.atur) | |
write.csv(tasa.aturCCAA, file = "tasaaturCCAA.csv") | |
aturProv <- read.csv("aturProv.csv", header = TRUE, sep = ",", quote = "\"", | |
dec = ".", fill = TRUE, comment.char = "") | |
#sels <- c("year", "ccaa", "tasa.atur") | |
#aturCCAA <- aturCCAA[,(names(aturCCAA) %in% sels)] | |
tasa.aturProv <- aturProv %>% | |
select(provincia, year, tasa.atur) %>% | |
spread(year, tasa.atur) | |
write.csv(tasa.aturProv, file = "tasaaturProv.csv") | |
###Total Unemployed | |
ltunemployedCCAA <- aturCCAA %>% | |
select(ccaa, year, AturatsLlT) %>% | |
spread(year, AturatsLlT) | |
write.csv(ltunemployedCCAA, file = "ltaturCCAA.csv") | |
aturProv <- read.csv("aturProv.csv", header = TRUE, sep = ",", quote = "\"", | |
dec = ".", fill = TRUE, comment.char = "") | |
ltunemployedProv <- aturProv %>% | |
select(provincia, year, AturatsLlT) %>% | |
spread(year, AturatsLlT) | |
write.csv(ltunemployedProv, file = "ltaturProv.csv") |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Bar Chart, Framed</title> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script> | |
<style type="text/css"> | |
body { | |
margin: 0; | |
background-color: lightGray; | |
font-family: Helvetica, Arial, sans-serif; | |
} | |
div { | |
background-color: #F2F2F2; | |
} | |
#UnemploymentRate { | |
width: 700px; | |
margin-left: auto; | |
margin-right: auto; | |
margin-top: 50px; | |
padding: 50px; | |
background-color: white; | |
box-shadow: 3px 3px 5px 6px #ccc; | |
} | |
#Unemployed { | |
width: 700px; | |
margin-left: auto; | |
margin-right: auto; | |
margin-top: 50px; | |
padding: 50px; | |
background-color: white; | |
box-shadow: 3px 3px 5px 6px #ccc; | |
} | |
h1 { | |
margin: 0; | |
font-family: Helvetica, Arial, sans-serif; | |
font-size: 48px; | |
font-weight: bold; | |
color: #A01E0C; | |
border-bottom: solid 8px #A01E0C; | |
} | |
h2 { | |
font-family: Helvetica, Arial, sans-serif; | |
font-size: 24px; | |
font-weight: bold; | |
color: black; | |
text-align:justify; | |
} | |
h3 { | |
font-family: Helvetica, Arial, sans-serif; | |
font-size: 16px; | |
font-weight: normal; | |
font-style: italic; | |
color: black; | |
} | |
p { | |
font-family: Helvetica; | |
font-size: 12px; | |
font-weight: normal; | |
color: black; | |
text-align:justify; | |
line-height: 1.3; | |
margin: 15px 0 10px 0; | |
margin-top: 0em; | |
margin-bottom: 0.5em; | |
} | |
a:link { | |
text-decoration: none; | |
color: gray; | |
} | |
a:hover { | |
text-decoration: underline; | |
} | |
a:visited { | |
color: gray; | |
} | |
a:active { | |
color: steelBlue; | |
} | |
svg { | |
background-color: white; | |
} | |
g.bar text { | |
font-size: 10px; | |
font-weight: bold; | |
text-anchor: end; | |
opacity: 0; | |
} | |
g.bar{ | |
cursor:pointer; | |
} | |
g.bar:hover rect { | |
fill: #A01E0C; | |
} | |
g.bar:hover text { | |
opacity: 1; | |
} | |
g.highlight path { | |
stroke: rgb(205,10,30); | |
stroke-width: 3; | |
} | |
g.area text { | |
font-size: 11px; | |
font-weight: bold; | |
text-anchor: end; | |
opacity: 0; | |
} | |
g.area{ | |
cursor:pointer; | |
} | |
g.area:hover rect { | |
fill: #A01E0C; | |
} | |
g.area:hover text { | |
opacity: 1; | |
} | |
.axis path, | |
.axis line { | |
fill: none; | |
stroke: black; | |
shape-rendering: crispEdges; | |
} | |
.axis text { | |
font-family: sans-serif; | |
font-size: 11px; | |
} | |
.y.axis path, | |
.y.axis line { | |
opacity: 0; | |
} | |
.y2.axis path, | |
.y2.axis line { | |
opacity: 1; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="UnemploymentRate"> | |
<h1>Unemployment Rate in Spain</h1> | |
<p>The following code shows the unemployment rate in Spain for the last quarter of 2015. The raw data comes from the <a href="www.ine.es">Spanish National Statistics Institute (INE)</a>. In order to convert the raw data into an csv output that could be easily managed by D3, I made use of R, particularly the <a href = "https://www.rstudio.com/wp-content/uploads/2015/02/data-wrangling-cheatsheet.pdf"> tidyr and dplyr packages</a>. The R code can be found in the gist. This is just a first step of a much ambicious that will try to characterize unemployment in Spain. So far, the code produces a bar chart with the unemployment rate by CCAA (first level of government) and by province (second level) and a stacked area chart with the total number of unemployed since 2005 by province or CCAA. The objective is to add more features to the html.</p> | |
<input name="updateProv" | |
type="button" | |
value="By Provincia" | |
onclick="updateProv()" | |
/> | |
<input name="updateCCAA" | |
type="button" | |
value="By CCAA" | |
onclick="updateCCAA()" | |
/> | |
</div> | |
<div id="Unemployed"> | |
<h1>Total number of long term unemployed in Spain.</h1> | |
<p>Long term unemployment is defined as people that has been actively seeking for a job but hasn't find any for at least two years.</p> | |
</div> | |
<script type="text/javascript"> | |
var w = 700; | |
var h = 600; | |
var padding = [ 20, 10, 30, 136 ]; //Top, right, bottom, left | |
//Bar Chart | |
var widthScale = d3.scale.linear() | |
.range([ 0, w - padding[1] - padding[3] ]); | |
var heightScale = d3.scale.ordinal() | |
.rangeRoundBands([ padding[0], h - padding[2] ], 0.1); | |
var xAxis = d3.svg.axis() | |
.scale(widthScale) | |
.orient("bottom"); | |
var yAxis = d3.svg.axis() | |
.scale(heightScale) | |
.orient("left"); | |
//SVG goes into #UnemploymentRate instead of body | |
function drawbars(data){ | |
data.sort(function(a, b) { | |
return d3.descending(+a['2015'],+b['2015']); | |
}); | |
widthScale.domain([ 0, Math.ceil(d3.max(data, function(d) { | |
return +d['2015']; | |
})) ]); | |
heightScale.domain(data.map(function(d) { return d.id1; } )); | |
var svg = d3.select("#UnemploymentRate") | |
.append("svg") | |
.attr("width", w) | |
.attr("height", h); | |
//Bind data to groups (not bars directly) | |
var groups = svg.selectAll("g") | |
.data(data); | |
groups.exit().remove(); | |
groups.enter().append("g") | |
.attr("class", "bar"); | |
//Add a rect to each group | |
var rects = groups.append("rect") | |
.attr("x", padding[3]) | |
.attr("y", function(d) { | |
return heightScale(d.id1); | |
}) | |
.attr("width", 0) | |
.attr("height", heightScale.rangeBand()) | |
.attr("fill", function(d) { | |
if (d.id1 === "Espanya") { | |
return "rgb(205, 10, 30)";} | |
else{ | |
return "steelblue";} | |
}); | |
//.attr("fill", "steelblue"); | |
//Add a text element to each group | |
groups.append("text") | |
.attr("x", function(d) { | |
return padding[3] + widthScale(d['2015']) - 3; | |
}) | |
.attr("y", function(d) { | |
return heightScale(d.id1) + 10; | |
}) | |
.text(function(d) { | |
return Math.round(d['2015']*100)/100 + "%"; | |
}); | |
rects.transition() | |
.delay(function(d, i) { | |
return i * 50; | |
}) | |
.duration(1000) | |
.attr("width", function(d) { | |
return widthScale(d['2015']); | |
}); | |
svg.append("g") | |
.attr("class", "x axis") | |
.attr("transform", "translate(" + padding[3] + "," + (h - padding[2]) + ")") | |
.call(xAxis); | |
svg.append("g") | |
.attr("class", "y axis") | |
.attr("transform", "translate(" + padding[3] + ",0)") | |
.call(yAxis); | |
//groups.exit().remove(); | |
} | |
//Stack are chart method | |
var stack = d3.layout.stack() | |
.values(function(d) { | |
return d.aturats; | |
}) | |
.order("reverse"); | |
var dateFormat = d3.time.format("%Y"); | |
var xScale = d3.time.scale() | |
.range([ padding[3], w - padding[1] - padding[3] ]); | |
var yScale = d3.scale.linear() | |
.range([ padding[0], h - padding[2] ]); | |
//Configure axis generators | |
var xAxis2 = d3.svg.axis() | |
.scale(xScale) | |
.orient("bottom") | |
.ticks(15) | |
.tickFormat(function(d) { | |
return dateFormat(d); | |
}); | |
var yAxis2 = d3.svg.axis() | |
.scale(yScale) | |
.orient("left") | |
.ticks(5); | |
var area = d3.svg.area() | |
.x(function(d) { | |
return xScale(dateFormat.parse(d3.format("")(d.x))); | |
}) | |
.y0(function(d) { | |
return yScale(d.y0); //Updated | |
}) | |
.y1(function(d) { | |
return yScale(d.y0 + d.y); //Updated | |
}); | |
var color = d3.scale.category10(); | |
function populate_years(start, end, step){ | |
var years = []; //empty years array | |
//YOUR CODE HERE | |
//_.range(start, end, step); | |
for (var yr = start; yr<= end; yr += step) { | |
if (yr !== 1942 && yr!==1946){ | |
years.push(yr); | |
} | |
} | |
return years; //return years array | |
} | |
function drawstacked(data){ | |
//d3.select("svg").remove(); | |
var svg2 = d3.select("#Unemployed") | |
.append("svg") | |
.attr("width", w) | |
.attr("height", h); | |
var years = populate_years(2005,2015,1); | |
var dataset = []; | |
for (var i = 0; i < data.length; i++) { | |
//Create new object with id name and empty array | |
dataset[i] = { | |
identificador: data[i].id1, | |
aturats: [] | |
}; | |
//Loop through all the quarters | |
for (var j = 0; j < years.length; j++) { | |
//Default value, used in case no value is present | |
var amount = null; | |
// If value is not empty | |
if (data[i][years[j]]) { | |
amount = +data[i][years[j]]; | |
} | |
//Add a new object to the aturats data array | |
//for this identificador | |
dataset[i].aturats.push({ | |
x: years[j], | |
y: amount | |
}); | |
} | |
} | |
//Stack the data! | |
stack(dataset); | |
//Uncomment to log the original data to the console | |
//console.log(data); | |
//Uncomment to log the newly restructured dataset to the console | |
//console.log(dataset); | |
xScale.domain([ | |
d3.min(years, function(d) { | |
return dateFormat.parse(d3.format("")(d)); | |
}), | |
d3.max(years, function(d) { | |
return dateFormat.parse(d3.format("")(d)); | |
}) | |
]); | |
var totals = []; | |
for (i = 0; i < years.length; i++) { | |
totals[i] = 0; | |
for (j = 0; j < dataset.length; j++) { | |
totals[i] += dataset[j].aturats[i].y; | |
} | |
} | |
yScale.domain([ d3.max(totals), 0 ]); | |
var paths = svg2.selectAll("path") | |
.data(dataset); | |
paths.exit().remove(); | |
paths.enter() | |
.append("path") | |
//.filter(funcion(d){return d.identificador != "Espanya";}) | |
.attr("class", "area") | |
.attr("d", function(d) { | |
return area(d.aturats); | |
}) | |
.attr("stroke", "none") | |
.attr("fill", function(d, i) { | |
return color(i); | |
}); | |
//Append a title with the country name (so we get easy tooltips) | |
paths.append("title") | |
.text(function(d) { | |
return d.identificador; | |
}); | |
//Create axes | |
svg2.append("g") | |
.attr("class", "x axis") | |
.attr("transform", "translate(0," + (h - padding[2]) + ")") | |
.call(xAxis2); | |
svg2.append("g") | |
.attr("class", "y axis") | |
.attr("transform", "translate(" + padding[3] + ",0)") | |
.call(yAxis2); | |
//paths.exit().remove(); | |
} | |
function datafilter(d){ | |
data = data.filter(function(d) { return d.id1 != "Espanya";}); | |
return data;} | |
function updateProv(){ | |
d3.select("svg").remove(); | |
d3.csv("tasaaturProv2.csv", | |
//function(data) { | |
// console.log(data);}) | |
drawbars); | |
d3.select("svg").remove(); | |
d3.csv("ltaturProv2.csv", | |
//function(data) { | |
// console.log(data);}) | |
drawstacked); | |
} | |
function updateCCAA(){ | |
d3.select("svg").remove(); | |
d3.csv("tasaaturCCAA2.csv", | |
//function(data) { | |
// console.log(data);}) | |
drawbars); | |
d3.select("svg").remove(); | |
d3.csv("ltaturCCAA2.csv", drawstacked); | |
} | |
</script> | |
<p class="source"> Font: Spanish National Institute of Statistics <a href="http://www.ine.es/dyngs/INEbase/es/operacion.htm?c=Estadistica_C&cid=1254736176918&menu=resultados&secc=1254736030639&idp=1254735976595">Active Population Survey Microdata </a> | |
</p> | |
</body> | |
</html> |
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
id1 | 2005 | 2006 | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Andalucia | 173643.42 | 130667.53 | 140502.87 | 219658.96 | 397283.3 | 513219.08 | 645303.07 | 826431.58 | 902660.2 | 862481.72 | 735812.1 | |
2 | Aragon | 5398.09 | 7331.94 | 6538.67 | 8854.98 | 29156.54 | 49602.13 | 52887.24 | 67405.82 | 82509.29 | 64755.51 | 51629.59 | |
3 | Asturias | 19533.36 | 15894.79 | 14595.44 | 14416.1 | 29991.9 | 36509.81 | 41453.4 | 60096.62 | 73131.45 | 61437.78 | 59401.7 | |
4 | Baleares | 6492.48 | 5719.62 | 6466.7 | 6911.41 | 34783.33 | 44066.63 | 51256.4 | 64684.75 | 69208.44 | 52150.8 | 38998.36 | |
5 | Canarias | 33738.79 | 27727.86 | 30557.03 | 55051.54 | 111941.93 | 153079.77 | 172473.04 | 209923.78 | 238463.04 | 236874.42 | 186436.7 | |
6 | Cantabria | 7141.54 | 4831.01 | 3388.74 | 4094.15 | 9616.42 | 17842.04 | 21601.22 | 29181.38 | 33121.85 | 32549.57 | 27186.6 | |
7 | Castilla-La Mancha | 26502.4 | 19666.29 | 18127.15 | 27492.26 | 64507.28 | 101238.57 | 128211.01 | 175002.56 | 198221.26 | 186819.3 | 156637.94 | |
8 | Castilla-Leon | 31396.91 | 27563.94 | 23413.05 | 36378.36 | 56633.71 | 81223.08 | 102692.88 | 130647.94 | 159522.5 | 153391.55 | 124046.79 | |
9 | Catalunya | 52808.03 | 59757.59 | 64040.13 | 92068.63 | 213489.83 | 364419 | 420339.74 | 522761.42 | 500439.82 | 456682.03 | 397288.17 | |
10 | Ceuta | 3999.13 | 1912.54 | 3022.23 | 2623.35 | 3678.99 | 4468.68 | 5552.15 | 8853.13 | 10367.44 | 10389.61 | 5931.86 | |
11 | Comunitat Valenciana | 54750.4 | 51590.24 | 43157.54 | 68309.76 | 203095.53 | 285917.49 | 353463.5 | 393022.41 | 423715.25 | 377468.96 | 338919.55 | |
13 | Extremadura | 23205.25 | 23188.78 | 22599.52 | 24492.43 | 37632.26 | 56247.26 | 67168.05 | 100107.36 | 98218.27 | 90604.81 | 82443.7 | |
14 | Galicia | 41619.53 | 33532.34 | 30778.63 | 34901.46 | 60863.66 | 88066.45 | 122972.84 | 149181.36 | 171678.78 | 158958.25 | 136096.44 | |
15 | La Rioja | 2601.38 | 3243.66 | 2415.14 | 3537.35 | 7773.99 | 10709.18 | 14721.9 | 15373.8 | 17133.53 | 16589.69 | 13604.51 | |
16 | Madrid | 56648.14 | 54775.75 | 49957.53 | 67213.08 | 169041.69 | 241098.78 | 288670.71 | 361226.62 | 433660.8 | 385804.76 | 339391.08 | |
17 | Melilla | 1051.6 | 1805.13 | 2514.57 | 1807.08 | 3626.89 | 4539.59 | 5520.43 | 5109.6 | 8375 | 7353.47 | 7161.41 | |
18 | Murcia | 11695.78 | 13557.46 | 10407.38 | 18677.18 | 50558.91 | 87919.98 | 98376.16 | 113160.29 | 120886.45 | 121443.82 | 101275.99 | |
19 | Navarra | 6594.51 | 2703.17 | 3210.54 | 3679.14 | 8653.22 | 15690.79 | 17658.87 | 27111.65 | 29344.82 | 27207.91 | 24233.18 | |
20 | Pais Vasco | 23540.69 | 25942.54 | 20633.14 | 20091.9 | 43268.32 | 53691.25 | 83466.51 | 97607.88 | 102270.37 | 113366.73 | 82613.57 |
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
id1 | 2005 | 2006 | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Alava | 3154.48 | 3475.84 | 1321.48 | 820.88 | 5379.08 | 6469.6 | 9920.95 | 16132.32 | 16409.03 | 17655.65 | 11290.8 | |
2 | Albacete | 7619.01 | 5304.04 | 5587.21 | 6670.68 | 14871.57 | 22510.74 | 26522.3 | 34805.9 | 39706.76 | 33351.49 | 28703.44 | |
3 | Alicante | 28759.49 | 21776.43 | 20334.87 | 33268.88 | 82604.41 | 123230.94 | 139001.69 | 147717.34 | 178994.13 | 151132.6 | 143373.41 | |
4 | Almeria | 4653.85 | 6146.75 | 5786.81 | 14016.69 | 30699.11 | 35982.15 | 61423.64 | 68538.19 | 79715.45 | 79204.43 | 53682.03 | |
5 | Asturias | 19533.36 | 15894.79 | 14595.44 | 14416.1 | 29991.9 | 36509.81 | 41453.4 | 60096.62 | 73131.45 | 61437.78 | 59401.7 | |
6 | Avila | 1450.01 | 1561.01 | 1071.99 | 1848.31 | 6619.71 | 7326.67 | 9360.84 | 10488.22 | 13273.49 | 12349.71 | 9778.23 | |
7 | Badajoz | 15520.13 | 18030.18 | 15360.6 | 16276.29 | 26772.6 | 41774.63 | 43205.67 | 66981.42 | 62068.12 | 61496.5 | 54633.5 | |
8 | Baleares | 6492.48 | 5719.62 | 6466.7 | 6911.41 | 34783.33 | 44066.63 | 51256.4 | 64684.75 | 69208.44 | 52150.8 | 38998.36 | |
9 | Barcelona | 38859.74 | 48193.69 | 52715.62 | 72717 | 156074.37 | 286693.24 | 319907.4 | 400983.45 | 368705.97 | 336429.66 | 289258.74 | |
10 | Burgos | 2555.52 | 3141.18 | 2735.59 | 5836.3 | 7088.59 | 14982.39 | 11296.38 | 14021.55 | 19677.09 | 19929.08 | 16635.62 | |
11 | Caceres | 7685.12 | 5158.6 | 7238.92 | 8216.14 | 10859.66 | 14472.63 | 23962.38 | 33125.94 | 36150.15 | 29108.31 | 27810.2 | |
12 | Cadiz | 38079.29 | 22251.89 | 28167.29 | 39064.05 | 71795.18 | 88776.43 | 103761.53 | 142394.16 | 152226.81 | 173599 | 148199.57 | |
13 | Cantabria | 7141.54 | 4831.01 | 3388.74 | 4094.15 | 9616.42 | 17842.04 | 21601.22 | 29181.38 | 33121.85 | 32549.57 | 27186.6 | |
14 | Castellon | 2369.95 | 3296.12 | 3387.94 | 5426.96 | 20669.99 | 35869.13 | 41351.02 | 40107.84 | 47026.57 | 43562.68 | 34225.73 | |
15 | Ceuta | 3999.13 | 1912.54 | 3022.23 | 2623.35 | 3678.99 | 4468.68 | 5552.15 | 8853.13 | 10367.44 | 10389.61 | 5931.86 | |
16 | Ciudad Real | 6079.91 | 6763.34 | 5385.67 | 8937.15 | 13779.41 | 23199.72 | 32535.81 | 43776.34 | 48841.18 | 53250.28 | 43452.24 | |
17 | Cordoba | 20808.29 | 21702.63 | 16622.57 | 25021.19 | 37079.52 | 48055.68 | 58792.93 | 77399.28 | 81826.99 | 78303.61 | 67362.89 | |
18 | Cuenca | 1191.16 | 1029.95 | 990.08 | 1258.54 | 5307.69 | 8733.89 | 9565.2 | 13698.68 | 16241.68 | 17149.01 | 10760.17 | |
20 | Girona | 3499.78 | 5644.18 | 5251.01 | 11515.11 | 28570.91 | 31241.77 | 42731.23 | 49048.95 | 50555.4 | 51494.81 | 41537.59 | |
21 | Granada | 22568.68 | 15627.78 | 15061.18 | 24640.87 | 48972.86 | 52762.04 | 64599.44 | 90887.43 | 100010.57 | 89153.67 | 69093.38 | |
22 | Guadalajara | 3573.73 | 792.04 | 1684.76 | 1617.28 | 5615.3 | 9571.53 | 11837.5 | 18214.31 | 15542.87 | 18703.35 | 14825.89 | |
23 | Guipuzcoa | 7044.08 | 6149.66 | 6678.98 | 3673.83 | 10781.51 | 9889.04 | 18988.33 | 21109.4 | 25473.24 | 27448.49 | 21486.08 | |
24 | Huelva | 10084.94 | 4486.72 | 7586.84 | 8009.47 | 14207.14 | 29799.17 | 44386.49 | 43245.15 | 41837.53 | 39466.59 | 39039.68 | |
25 | Huesca | 1154.03 | 1309.36 | 902.08 | 1156.96 | 3628.8 | 6880.67 | 6109.15 | 8497.37 | 11185.64 | 7952.76 | 6034.79 | |
26 | Jaen | 16293.45 | 12938.79 | 10123.97 | 13529.27 | 23233.66 | 27584.07 | 37162.3 | 47072.73 | 62224.75 | 50951.72 | 48045.69 | |
27 | La Coruna | 17400.25 | 13722.99 | 14889.7 | 14779.36 | 22185.35 | 33289.69 | 40598.21 | 55373.09 | 64484.96 | 58456.13 | 49870.47 | |
28 | La Rioja | 2601.38 | 3243.66 | 2415.14 | 3537.35 | 7773.99 | 10709.18 | 14721.9 | 15373.8 | 17133.53 | 16589.69 | 13604.51 | |
29 | Las Palmas | 17582.16 | 15974.07 | 17446.82 | 28926.51 | 62722.39 | 80253.44 | 94033.12 | 115951.9 | 135717.52 | 129528.61 | 103776.52 | |
30 | Leon | 7345.4 | 5529.76 | 5065.08 | 6539.94 | 9202.07 | 14884.06 | 20885.06 | 28698.69 | 33153.26 | 32486.16 | 28174.06 | |
31 | Lleida | 3076.15 | 1650.54 | 1631.44 | 2960.08 | 7077.8 | 12121.08 | 15557.98 | 18045.11 | 18214.92 | 15466.58 | 15380.93 | |
32 | Lugo | 4514.98 | 2562.7 | 2347.06 | 2145.62 | 5210.51 | 6154.34 | 9179.09 | 12642.7 | 17638.18 | 15176.6 | 15002.79 | |
33 | Madrid | 56648.14 | 54775.75 | 49957.53 | 67213.08 | 169041.69 | 241098.78 | 288670.71 | 361226.62 | 433660.8 | 385804.76 | 339391.08 | |
34 | Malaga | 21791.56 | 14712.6 | 21830.99 | 49691.96 | 81915.82 | 111971.52 | 132574.07 | 174023.77 | 177477.84 | 162355.91 | 131261 | |
35 | Melilla | 1051.6 | 1805.13 | 2514.57 | 1807.08 | 3626.89 | 4539.59 | 5520.43 | 5109.6 | 8375 | 7353.47 | 7161.41 | |
36 | Murcia | 11695.78 | 13557.46 | 10407.38 | 18677.18 | 50558.91 | 87919.98 | 98376.16 | 113160.29 | 120886.45 | 121443.82 | 101275.99 | |
37 | Navarra | 6594.51 | 2703.17 | 3210.54 | 3679.14 | 8653.22 | 15690.79 | 17658.87 | 27111.65 | 29344.82 | 27207.91 | 24233.18 | |
38 | Orense | 5228.09 | 2233.22 | 3053.3 | 2079.28 | 7867.41 | 10358.24 | 15964.14 | 18506.06 | 19159.45 | 17927.39 | 16138.29 | |
39 | Palencia | 2428.14 | 1792.74 | 1396.18 | 2234.33 | 4585.3 | 6034.34 | 6696.99 | 7041.78 | 10388.92 | 12928.53 | 9340.07 | |
40 | Pontevedra | 14476.21 | 15013.43 | 10488.57 | 15897.2 | 25600.39 | 38264.18 | 57231.4 | 62659.51 | 70396.19 | 67398.13 | 55084.89 | |
41 | Salamanca | 5910.2 | 6187.58 | 3725.65 | 7886.32 | 7211.5 | 10254.64 | 14543.17 | 19636.61 | 23249.12 | 20892.44 | 14322.59 | |
42 | Santa Cruz de Tenerife | 16156.63 | 11753.79 | 13110.21 | 26125.03 | 49219.54 | 72826.33 | 78439.92 | 93971.88 | 102745.52 | 107345.81 | 82660.18 | |
43 | Segovia | 1072.57 | 745.02 | 984 | 1771.34 | 2328.45 | 3282.39 | 6604.68 | 7870.88 | 7856.77 | 7513.97 | 7123.76 | |
44 | Sevilla | 39363.36 | 32800.37 | 35323.22 | 45685.46 | 89380.01 | 118288.02 | 142602.67 | 182870.87 | 207340.26 | 189446.79 | 179127.86 | |
45 | Soria | 394.87 | 457.88 | 334.1 | 360.33 | 1650.37 | 2175.56 | 2713.5 | 3229.06 | 4096.44 | 4700.31 | 3111.46 | |
46 | Tarragona | 7372.36 | 4269.18 | 4442.06 | 4876.44 | 21766.75 | 34362.91 | 42143.13 | 54683.91 | 62963.53 | 53290.98 | 51110.91 | |
47 | Teruel | 950.16 | 733.12 | 586.06 | 662.85 | 1437.8 | 4247.89 | 5889.8 | 5712.4 | 7784.72 | 8115.83 | 4505.07 | |
48 | Toledo | 8038.59 | 5776.92 | 4479.43 | 9008.61 | 24933.31 | 37222.69 | 47750.2 | 64507.33 | 77888.77 | 64365.17 | 58896.2 | |
49 | Valencia | 23620.96 | 26517.69 | 19434.73 | 29613.92 | 99821.13 | 126817.42 | 173110.79 | 205197.23 | 197694.55 | 182773.68 | 161320.41 | |
50 | Valladolid | 5757.6 | 5540.27 | 5432.86 | 7519.13 | 13711.71 | 16106.45 | 24982.14 | 28700.76 | 34686.24 | 27029.59 | 26059.6 | |
51 | Vizcaya | 13342.13 | 16317.04 | 12632.68 | 15597.19 | 27107.73 | 37332.61 | 54557.23 | 60366.16 | 60388.1 | 68262.59 | 49836.69 | |
52 | Zamora | 4482.6 | 2608.5 | 2667.6 | 2382.36 | 4236.01 | 6176.58 | 5610.12 | 10960.39 | 13141.17 | 15561.76 | 9501.4 | |
53 | Zaragoza | 3293.9 | 5289.46 | 5050.53 | 7035.17 | 24089.94 | 38473.57 | 40888.29 | 53196.05 | 63538.93 | 48686.92 | 41089.73 |
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
id1 | 2005 | 2006 | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Andalucia | 13.7977015823933 | 12.2172719473228 | 13.9618567050814 | 21.6610234947032 | 26.2721162009364 | 28.0356316288847 | 31.0050342659859 | 35.7133678475941 | 36.2595471665021 | 34.2296722365714 | 29.8256504044683 | |
2 | Aragon | 5.76238527395347 | 4.99127674709451 | 5.12363856492825 | 9.71001990665142 | 13.5727096418548 | 16.2934135753968 | 16.7955312843123 | 18.7171363714549 | 20.5943482205158 | 18.653073070165 | 14.6005296679125 | |
3 | Asturias | 9.30284841763348 | 9.08984403593178 | 8.00215436575447 | 10.0006257285253 | 14.1341929795103 | 16.614069012901 | 18.8419528242587 | 23.8236691447252 | 22.2928837912222 | 20.7797660276312 | 20.3269104896142 | |
4 | Baleares | 7.49608330958132 | 6.33735878415847 | 9.35181176996441 | 12.0476039778343 | 19.4460468635112 | 21.7777073620183 | 25.4883284763668 | 24.3014533706362 | 22.7160018884757 | 18.8821368203368 | 17.0168032462986 | |
5 | Canarias | 10.8832412432675 | 11.3671054325684 | 10.8939880852118 | 20.9854581808371 | 26.7742645845954 | 28.7807818643283 | 30.3298733007645 | 32.5970634815214 | 33.0899289311283 | 31.0825651020618 | 26.7532021456337 | |
6 | Cantabria | 8.01175696042273 | 5.8736686152187 | 4.72343845144794 | 8.80940503894567 | 12.7030751549236 | 14.6727390278338 | 15.9238915594331 | 19.1862544295409 | 19.8140633573946 | 18.4211991653904 | 17.7139552898417 | |
7 | Castilla-La Mancha | 9.42158811579203 | 8.05456454929787 | 8.1021018793326 | 15.0368939488434 | 19.2905184705434 | 21.7237818437608 | 24.5307061690766 | 30.0703928255502 | 28.9858471709042 | 28.5012404121443 | 24.9702271826124 | |
8 | Castilla-Leon | 8.53100741408073 | 7.58140029525771 | 6.93898397793072 | 11.4016742658243 | 14.2109512153821 | 15.7794200770785 | 17.2100982513963 | 20.7384952674438 | 22.0188189630136 | 20.2843057486682 | 17.5845623743123 | |
9 | Catalunya | 6.63295323896055 | 6.55828221535554 | 6.49819288400191 | 11.7510724687868 | 16.9025849714824 | 17.8640374293291 | 20.4043169090851 | 23.8088803818366 | 21.8726717186699 | 19.884668127141 | 17.7329692409863 | |
10 | Ceuta | 17.1400057725118 | 14.4357666770174 | 20.1778255475933 | 15.6641551153383 | 24.0082936295236 | 24.8295754496836 | 27.1890543923472 | 37.1749340363084 | 36.7760483956653 | 32.4607911355812 | 23.2517722917775 | |
11 | Comunitat Valenciana | 8.13080156936053 | 8.4803311290804 | 8.94361684773201 | 14.5790163079647 | 22.0878418557043 | 22.5724218843006 | 24.8287526755505 | 27.6160912243149 | 27.1468105731262 | 23.4830728343466 | 21.4506471370218 | |
12 | Espanya | 8.70532520053147 | 8.26461448714216 | 8.57012182817238 | 13.7856360280491 | 18.6648503463591 | 20.1144495855105 | 22.5564135912582 | 25.7745245699454 | 25.7278707624795 | 23.701687098073 | 20.8952391450625 | |
13 | Extremadura | 15.1591099782836 | 12.9439919671945 | 14.7909262549805 | 18.1056043779358 | 21.2137863613866 | 23.9460140448598 | 28.3253372471649 | 33.9738184523425 | 32.3952043003695 | 29.9632692546367 | 28.0667067331347 | |
14 | Galicia | 9.13856807576683 | 7.88350569120053 | 7.46013650593817 | 9.643968760908 | 12.7985287629469 | 15.6177784750478 | 18.1658125463868 | 21.1270346855088 | 21.8830729091191 | 20.8683933021841 | 17.7439907916905 | |
15 | La Rioja | 6.6874835420394 | 6.881902569842 | 5.8831508596504 | 9.80236598784334 | 13.7640197198446 | 15.5831537999396 | 18.6092081944458 | 18.8226510919118 | 20.2401697728839 | 17.1725252169445 | 13.974214480397 | |
16 | Madrid | 5.90011503145406 | 6.45570702446979 | 6.39875864297226 | 10.0235565071037 | 14.4833526593432 | 15.5429162454189 | 17.9604441542583 | 19.3177778507829 | 20.4511648788078 | 18.0025045850198 | 16.510931233374 | |
17 | Melilla | 12.330642764222 | 9.86267421811521 | 17.4284587894331 | 16.1650078077066 | 19.8674006881787 | 24.4595153767049 | 24.844433110759 | 26.4088092154629 | 33.7867926270711 | 29.5151936730204 | 32.6436601785626 | |
18 | Murcia | 7.42747401420103 | 7.85013077940831 | 8.2500823538196 | 15.2930175549608 | 21.8355141487538 | 24.4474850500666 | 26.3079147009961 | 29.3714701347721 | 28.4975785491223 | 27.2612967798266 | 23.5144905261363 | |
19 | Navarra | 5.92034730156846 | 4.58674122923403 | 4.27960921249115 | 8.13195127812838 | 10.51288964242 | 11.7735148460245 | 13.8023015668878 | 17.1692039089992 | 16.436266038067 | 14.9191676293687 | 13.5307870486895 | |
20 | Pais Vasco | 6.45061383218995 | 6.91806498356187 | 5.90343708960117 | 8.47651260106677 | 12.1302131899926 | 10.981538030949 | 13.1559045637643 | 16.6037475643101 | 16.5824715778857 | 16.600422110442 | 12.8929843987629 |
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
id1 | 2005 | 2006 | 2007 | 2008 | 2009 | 2010 | 2011 | 2012 | 2013 | 2014 | 2015 | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Alava | 6.45949179968114 | 6.14600214202902 | 4.55176745603213 | 7.78758723218847 | 14.7359361539971 | 11.1439590619628 | 11.7283681027108 | 19.4685533436564 | 18.7544195270603 | 16.6359159687462 | 12.2050134809443 | |
2 | Albacete | 10.7793579908775 | 8.22277445202129 | 10.5440442369979 | 17.0003357016337 | 21.4590818600898 | 21.2487236288107 | 25.3958145815733 | 33.9431874875348 | 29.0046478000632 | 27.302113008381 | 21.9675753427625 | |
3 | Alicante | 10.2758589775818 | 10.4182221817235 | 11.2321942480239 | 15.9242416334517 | 23.3550699831182 | 24.6849062568749 | 25.7616787292385 | 28.2028522247767 | 29.4754113049503 | 24.9094027228975 | 22.963171741056 | |
4 | Almeria | 9.82684357295033 | 9.26052633437662 | 10.7789077953159 | 24.2224494762318 | 24.5675290641554 | 26.525796631535 | 32.7371821101278 | 35.1895277951081 | 35.6882916929106 | 35.6964865611839 | 25.1309634109748 | |
5 | Asturias | 9.30284841763348 | 9.08984403593178 | 8.00215436575447 | 10.0006257285253 | 14.1341929795103 | 16.614069012901 | 18.8419528242587 | 23.8236691447252 | 22.2928837912222 | 20.7797660276312 | 20.3269104896142 | |
6 | Avila | 8.52011076868441 | 7.2897412038367 | 5.68102793591431 | 15.2103985591953 | 21.0673802698017 | 22.3005701948627 | 21.8860108533371 | 22.3765849451999 | 25.4831687474956 | 25.3330603749949 | 21.0779461053096 | |
7 | Badajoz | 16.5776835943729 | 14.6303391971538 | 15.3428595706816 | 19.2877004764736 | 22.7613165984157 | 26.1004106698388 | 30.4960447260342 | 35.4863465422479 | 33.0661684292607 | 31.5369830874439 | 30.0065701218353 | |
8 | Baleares | 7.49608330958132 | 6.33735878415847 | 9.35181176996441 | 12.0476039778343 | 19.4460468635112 | 21.7777073620183 | 25.4883284763668 | 24.3014533706362 | 22.7160018884757 | 18.8821368203368 | 17.0168032462986 | |
9 | Barcelona | 6.50710151684943 | 6.70540731902622 | 6.35380739356631 | 11.3664475072801 | 16.8481296677761 | 17.7646291247796 | 20.0638355386368 | 24.0198318107185 | 21.3865219989288 | 19.4993682518742 | 17.1457366935803 | |
10 | Burgos | 6.47346529524762 | 5.49723934150559 | 7.45472375249514 | 10.5910693464079 | 14.5539613617226 | 16.346954603127 | 14.9662554079751 | 17.8407402214748 | 19.0764804028938 | 18.7604653861593 | 17.7152587230915 | |
11 | Caceres | 12.8624272912175 | 10.1622783947029 | 13.8726904422373 | 15.9705822569831 | 18.3788411106897 | 19.9935343698647 | 24.5645522775868 | 31.2579739632744 | 31.2627746457622 | 27.3029774328765 | 24.6769429439291 | |
12 | Cadiz | 17.4068289660258 | 13.7431153771223 | 17.3484134110782 | 21.8036863312869 | 28.487537932521 | 31.2593895001619 | 35.0272939229759 | 39.837653059886 | 40.4652108503612 | 42.3356950684302 | 36.7320801723602 | |
13 | Cantabria | 8.01175696042273 | 5.8736686152187 | 4.72343845144794 | 8.80940503894567 | 12.7030751549236 | 14.6727390278338 | 15.9238915594331 | 19.1862544295409 | 19.8140633573946 | 18.4211991653904 | 17.7139552898417 | |
14 | Castellon | 6.55829704670816 | 6.61996715643437 | 7.04679209162036 | 14.2913997848439 | 21.1845162551767 | 23.468662566523 | 25.8535519331024 | 26.7380901219761 | 27.3293349490537 | 24.6193565332096 | 19.5257144458011 | |
15 | Ceuta | 17.1400057725118 | 14.4357666770174 | 20.1778255475933 | 15.6641551153383 | 24.0082936295236 | 24.8295754496836 | 27.1890543923472 | 37.1749340363084 | 36.7760483956653 | 32.4607911355812 | 23.2517722917775 | |
16 | Ciudad Real | 10.0244777157389 | 10.1325498109352 | 9.33365547733244 | 15.9107505742898 | 21.1694385488121 | 22.0746523311359 | 27.239115509547 | 30.7394076286081 | 30.032357635127 | 33.3905239463634 | 28.9479960083014 | |
17 | Cordoba | 15.6734338149285 | 15.3910811625224 | 14.6868469031538 | 20.189810559969 | 25.9623570034376 | 28.6975896836908 | 31.3620770367177 | 34.8574978059031 | 36.6768174983605 | 33.8792719386036 | 29.6952340101075 | |
18 | Cuenca | 7.72157753312435 | 6.4937045053753 | 3.89973517168895 | 9.7973483566298 | 16.9728105613027 | 19.9836584386856 | 19.6830255601954 | 25.8037342250203 | 26.123298183063 | 27.1608107434326 | 18.7777806239908 | |
19 | Espanya | 8.70532520053147 | 8.26461448714216 | 8.57012182817238 | 13.7856360280491 | 18.6648503463591 | 20.1144495855105 | 22.5564135912582 | 25.7745245699454 | 25.7278707624795 | 23.701687098073 | 20.8952391450625 | |
20 | Girona | 6.67899183446201 | 6.9192950146644 | 9.06253007667476 | 13.8551053429693 | 18.8812885325509 | 18.4534077068066 | 23.1970367252842 | 23.8053814928996 | 23.6927871157072 | 22.4061457787127 | 19.7340911616345 | |
21 | Granada | 13.1428563567641 | 10.5485750226137 | 13.8513612813947 | 23.3929381335588 | 27.8083513145872 | 28.8775787341428 | 29.0127955048732 | 37.4330643164404 | 35.8165874989373 | 35.1100653377607 | 28.8153746945048 | |
22 | Guadalajara | 7.01476389542391 | 6.62000235340149 | 6.1410553801264 | 11.8319899763638 | 13.4496992049902 | 19.5275745030268 | 21.0693045896013 | 24.9243633295265 | 21.2612322730161 | 23.4596869805533 | 19.2916781055466 | |
23 | Guipuzcoa | 5.36066630223453 | 6.43043409685477 | 5.35860017409334 | 6.74067102781982 | 9.15303131433797 | 7.66904516317979 | 10.8591884634547 | 13.2438805737033 | 13.8007735126215 | 14.0497624770973 | 10.1584674031471 | |
24 | Huelva | 16.5209338535856 | 13.4493870940269 | 16.717685797289 | 21.0974123984604 | 23.8316633332019 | 30.0469939009206 | 34.2588490964459 | 36.5228259113396 | 31.3733073134998 | 35.2590837068268 | 32.6485446129497 | |
25 | Huesca | 6.75473066472965 | 5.24451030656796 | 4.58700988965738 | 6.63634724194675 | 11.6799816840543 | 12.6534825466996 | 13.9806350622576 | 14.352168342026 | 19.6059263995072 | 16.935281588608 | 12.3844043477531 | |
26 | Jaen | 17.0386174694916 | 12.861935506984 | 14.6339989000249 | 19.8948647088965 | 24.8674710880442 | 25.8406366945294 | 28.2249033945592 | 36.2985679849481 | 36.3494886386 | 33.3343926036583 | 30.8417868671181 | |
27 | La Coruna | 9.06965318485511 | 8.12750047734883 | 8.39008143106282 | 9.37859536078568 | 11.5481624435555 | 14.4425165489545 | 15.895119724776 | 19.9101229641509 | 19.9686355050159 | 18.4086673867344 | 15.807630605262 | |
28 | La Rioja | 6.6874835420394 | 6.881902569842 | 5.8831508596504 | 9.80236598784334 | 13.7640197198446 | 15.5831537999396 | 18.6092081944458 | 18.8226510919118 | 20.2401697728839 | 17.1725252169445 | 13.974214480397 | |
29 | Las Palmas | 11.9973347043629 | 11.9420144469424 | 11.9863319119418 | 22.307060845091 | 28.7950843713267 | 31.3625312559605 | 31.6628488663946 | 33.5359056987142 | 33.4706710075868 | 32.6954483763813 | 27.639169703463 | |
30 | Leon | 10.7717646870104 | 7.74603554638841 | 7.63370466038692 | 10.4687095622948 | 15.0652976667232 | 16.3363866347468 | 17.8281810776603 | 23.4157695697276 | 24.3928363353269 | 22.6537868008097 | 20.3080536096945 | |
31 | Lleida | 6.86196928565282 | 4.15561244673106 | 3.16601047448271 | 9.4018384457059 | 12.8390355776249 | 14.541709927323 | 17.2339812785932 | 17.9422543770343 | 16.0535696065968 | 14.460251293841 | 14.2565115437552 | |
32 | Lugo | 7.53032154591737 | 4.65660320093728 | 6.12481238342938 | 6.73251085681254 | 10.3134525900331 | 10.2603965909668 | 11.9953379617686 | 16.7315888798545 | 19.0327692861469 | 16.2386598048995 | 15.8454869197054 | |
33 | Madrid | 5.90011503145406 | 6.45570702446979 | 6.39875864297226 | 10.0235565071037 | 14.4833526593432 | 15.5429162454189 | 17.9604441542583 | 19.3177778507829 | 20.4511648788078 | 18.0025045850198 | 16.510931233374 | |
34 | Malaga | 11.0591034030565 | 10.3632153094194 | 12.3625335047275 | 23.3655629542594 | 27.3731539256402 | 30.1167059399457 | 31.2954343375869 | 35.5018475546931 | 36.1997606553274 | 30.8614496565471 | 26.9780478901674 | |
35 | Melilla | 12.330642764222 | 9.86267421811521 | 17.4284587894331 | 16.1650078077066 | 19.8674006881787 | 24.4595153767049 | 24.844433110759 | 26.4088092154629 | 33.7867926270711 | 29.5151936730204 | 32.6436601785626 | |
36 | Murcia | 7.42747401420103 | 7.85013077940831 | 8.2500823538196 | 15.2930175549608 | 21.8355141487538 | 24.4474850500666 | 26.3079147009961 | 29.3714701347721 | 28.4975785491223 | 27.2612967798266 | 23.5144905261363 | |
37 | Navarra | 5.92034730156846 | 4.58674122923403 | 4.27960921249115 | 8.13195127812838 | 10.51288964242 | 11.7735148460245 | 13.8023015668878 | 17.1692039089992 | 16.436266038067 | 14.9191676293687 | 13.5307870486895 | |
38 | Orense | 9.44471234779067 | 8.19481407347795 | 5.28860802522427 | 6.46207972208075 | 12.7365281780666 | 16.946461528655 | 18.7818602328377 | 22.7327276861462 | 23.2315925122438 | 20.5881030479326 | 18.7837999984164 | |
39 | Palencia | 5.21187025642913 | 6.11000925628637 | 5.58267251750173 | 11.51014690212 | 12.7729918980143 | 16.6995523442537 | 17.6910559452003 | 18.7390768264607 | 21.1556113224691 | 23.2236198153638 | 19.0851601843173 | |
40 | Pontevedra | 9.67655419054723 | 8.6217064640112 | 7.53079826798881 | 11.9586692996298 | 15.1541018954593 | 18.5474041786927 | 22.8634337364834 | 23.6252733107616 | 24.7497363472531 | 25.460719112085 | 20.4704710855619 | |
41 | Salamanca | 11.9242234743011 | 10.3696887388441 | 7.27511563237589 | 16.6290015267626 | 13.6664234158124 | 15.7546338480244 | 17.1653559374145 | 21.3845428501166 | 22.9918985786722 | 21.2461258368317 | 15.7787808965507 | |
42 | Santa Cruz de Tenerife | 9.62330019826781 | 10.7198187122727 | 9.64913536322682 | 19.5035952031987 | 24.4859165700538 | 26.0089551918977 | 28.8903131821197 | 31.5310562825331 | 32.6580638473594 | 29.3234514360808 | 25.8181848336369 | |
43 | Segovia | 4.95690665791336 | 6.23714817759022 | 6.15993582424274 | 10.7789441804852 | 10.0845401405171 | 10.7763784013368 | 15.7483918254699 | 20.880367770888 | 17.7917279227763 | 14.3256351122631 | 15.7518397622383 | |
44 | Sevilla | 12.997018096642 | 12.8920190477264 | 13.1804750519136 | 19.7189013850874 | 25.1549934624238 | 24.4183076669421 | 28.3652667352118 | 32.6157402623413 | 35.2733629610414 | 31.4065725695055 | 29.0763013476464 | |
45 | Soria | 4.06478342928589 | 5.66581375093606 | 4.06873146274708 | 5.66496994306119 | 12.2446301832841 | 13.5527497238754 | 12.9020380434492 | 15.8743937462646 | 16.3228869357804 | 16.9554156955015 | 13.3257085132722 | |
46 | Tarragona | 7.41512105600353 | 6.42661356897646 | 6.8582029216991 | 13.7432309335687 | 17.6615669068813 | 19.7137050188111 | 21.8599196604496 | 25.5383499216459 | 26.6505741953187 | 23.1175478373731 | 21.8623152230215 | |
47 | Teruel | 5.53915433884383 | 2.88140305695444 | 4.42721011870721 | 7.40695576254012 | 8.83985099394765 | 13.3863125390102 | 14.775569352031 | 15.6980777272079 | 19.647076680399 | 19.73897878901 | 13.0015669493105 | |
48 | Toledo | 9.48160428136459 | 7.4219115871416 | 7.66618895606083 | 15.9606121403887 | 19.5450440650839 | 23.1016833037366 | 24.7529713264702 | 30.6855888614265 | 31.8522126481246 | 28.0741744002046 | 27.912167030274 | |
49 | Valencia | 7.08278358681174 | 7.59797328650456 | 7.85179994594195 | 13.7027856539784 | 21.4098777578559 | 20.9029270855738 | 23.9443833149884 | 27.4148456316097 | 25.4348691079746 | 22.20685688792 | 20.7877580143963 | |
50 | Valladolid | 8.11549935094125 | 7.99513286353131 | 6.82316633064358 | 9.67529745461117 | 13.538075327357 | 14.379408350388 | 17.8588141692438 | 19.7283514575082 | 22.0258258055807 | 16.6476305196227 | 15.615038127881 | |
51 | Vizcaya | 7.12333807377488 | 7.4214358291258 | 6.64378437831111 | 9.77253163302719 | 13.2645671914849 | 12.9131184379944 | 14.9952140475263 | 17.6906987010771 | 17.6128064997122 | 18.1155604586103 | 14.7875641619656 | |
52 | Zamora | 10.7143386186397 | 9.04921838943912 | 8.425140470973 | 11.3497614649877 | 14.4285834439423 | 16.697922879825 | 17.3375139090253 | 25.4134679774069 | 25.2905095657486 | 26.6229389606954 | 19.5644735034377 | |
53 | Zaragoza | 5.56220065596948 | 5.22467639792522 | 5.34017637598897 | 10.7408735476099 | 14.6611467461509 | 17.5247423161698 | 17.7336190187639 | 20.0929830525675 | 20.9332985706097 | 18.8982415521942 | 15.3273297078456 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
The raw data used for this visualization comes from the Spanish National Institute of Statistics and is a collection of individual observation of people regarding their employment status. We processed that data from 2005 to 2015, both at a Province and CCAA level, using an R script. The visualization has the objectives of showing how step was the increase in the total number of long term unemployed in Spain and how much variability does the unemployment rate in Spain has.
Design
Because unemployment rate has a zero lower bound, it was clear for us that a bar chart would be a good way of comparing it between different units. In order to change from CCAA (similar to a state in the US) to Province (lowest level of government supported by the raw data, similar to a county in the US) we added a button to update the data from one to the other. As for the total number of long term unemployed, we went for a stack area graph. This way we can see the dynamics of the phenomena and try to find similarities in the data, in order to understand better what factors explain the crisis.
We are hoping to add more features to the html, as we think of it as a permanent beta version. One of those potential features is a desagregation of the unemployment rate by age and by education attainment, as well as a map of the unemployment in spain on order to have a spatial understanding of the problem.
Feedback
My first design didn't have the option to go from CCAA to Province and instead showed both. This was ok, but it meant more information on the screen than what was necessary so instead we introduced an update button. Also, instead of a stack area we had the lines for all the units which was harder to see, so we followed the advise of stacking them.
Resources - list any sources you consulted to create your visualization
Books
Websites