Abstract
Unificamos en una sola base de datos la información referida a los gastos e ingresos en las elecciones de presidentes desde 1989 hasta hoy
2006 | 2009 | 2013 | 2017 |
---|---|---|---|
1 gastos | 3 primera gastos | 7 primera gastos | 13 primera gastos |
2 ingresos | 4 segunda gastos | 8 segunda gastos | 14 segunda gastos |
5 primera ingresos | 9 primera ingresos | 15 primera ingresos | |
6 segunda ingresos | 10 segunda ingresos | 16 segunda ingresos | |
11 primera primarias | 17 Ingresos primarias | ||
12 segunda primarias | 18 Gastos primarias |
gastos_2006 <- readRDS("GI/3detalle_gastos_pp_pres2006.rds") # 1
ingresos_2006 <- readRDS("GI/3detalle_ingresos_pp_pres2006.rds") # 2
gastos_candidatos_2009<- readRDS("GI/gastos_elecciones_2009.rds") # 3
gastos_candidatos_2_2009<- readRDS("GI/gastos_elecciones_2009_2da_votacion_presidencial.rds") # 4
ingresos_candidatos_2009<- readRDS("GI/ingresos_elecciones_2009.rds") # 5
ingresos_candidatos_2_2009<- readRDS("GI/ingresos_elecciones_2009_2da_votacion_presidencial.rds") # 6
gastos_candidatos_2013<- readRDS("GI/detalle_gastos_candidatos_eleccion2013.rds") # 7
gastos_candidatos_2_2013<- readRDS("GI/detalle_gastos_candidatos_eleccion2013_segunda_votacion.rds") # 8
ingresos_candidatos_2013<- readRDS("GI/detalle_ingresos_candidatos_eleccion2013-1.rds") # 9
ingresos_candidatos_2_2013<- readRDS("GI/detalle_ingresos_candidatos_eleccion2013_segunda_votacion.rds") # 10
gastos_candidatos_prim_2013<- readRDS("GI/Gastos_Primarias_2013.rds") # 11
ingresos_candidatos_prim_2013<- readRDS("GI/Ingresos_Primarias_2013.rds") # 12
gastos_candidatos_actu_2017<- readRDS("GI/Gastos_Presidencial_y_Parlamentarias_2017._Actualizado_al_14_de_septiembre_de_2018-1.rds") # 13
gastos_segunda_pre_2017<- readRDS("GI/Publicacion_Gastos_Candidatos_2da_Votacion.rds") # 14
ingresos_candidatos_actu_2017<- readRDS("GI/Ingresos_Presidencial_y_Parlamentarias_2017._Actualizado_al_14_de_septiembre_de_2018.rds") # 15
ingresos_segunda_pre_2017<- readRDS("GI/Publicacion_Ingresos_Candidatos_2da_Votacion.rds") # 16
ingresos_candidatos_2017<- readRDS("GI/Ingresos_Primarias_2017_al_2017_09_29-1.rds") # 17
gastos_candidatos_2017<- readRDS("GI/Gastos_Primarias_2017_al_2017_09_29-1.rds") # 18
ingresos_candidatos_2_2013<- readRDS("GI/detalle_ingresos_candidatos_eleccion2013_segunda_votacion.rds")
limite <- nrow(ingresos_candidatos_2_2013)
head(ingresos_candidatos_2_2013,5)
## # A tibble: 5 x 20
## `PLANILLA DE IN~ ...2 ...3 ...4 ...5 ...6 ...7 ...8 ...9 ...10 ...11
## <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 ELECCIÓN PRESID~ <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
## 2 <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
## 3 <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
## 4 <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA> <NA>
## 5 ELECCION REGI~ ESTA~ RUN ~ NOMB~ FILI~ NOMB~ NOMB~ NOMB~ TIPO~ RUT ~
## # ... with 9 more variables: ...12 <chr>, ...13 <chr>, ...14 <chr>,
## # ...15 <chr>, ...16 <chr>, ...17 <chr>, ...18 <chr>, ...19 <chr>,
## # ...20 <chr>
ingresos_candidatos_2_2013n <- ingresos_candidatos_2_2013[5,]
head(ingresos_candidatos_2_2013n,5)
## # A tibble: 1 x 20
## `PLANILLA DE IN~ ...2 ...3 ...4 ...5 ...6 ...7 ...8 ...9 ...10 ...11
## <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 ELECCION REGI~ ESTA~ RUN ~ NOMB~ FILI~ NOMB~ NOMB~ NOMB~ TIPO~ RUT ~
## # ... with 9 more variables: ...12 <chr>, ...13 <chr>, ...14 <chr>,
## # ...15 <chr>, ...16 <chr>, ...17 <chr>, ...18 <chr>, ...19 <chr>,
## # ...20 <chr>
ingresos_candidatos_2_2013_sub <- ingresos_candidatos_2_2013[6:limite,]
head(ingresos_candidatos_2_2013_sub,5)
## # A tibble: 5 x 20
## `PLANILLA DE IN~ ...2 ...3 ...4 ...5 ...6 ...7 ...8 ...9 ...10 ...11
## <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 PRESIDENTE 13 Apro~ 5811~ MICH~ Afil~ PART~ <NA> <NA> I <NA>
## 2 PRESIDENTE 13 Apro~ 5811~ MICH~ Afil~ PART~ <NA> <NA> I 7170~
## 3 PRESIDENTE 13 Apro~ 5811~ MICH~ Afil~ PART~ <NA> <NA> I 7627~
## 4 PRESIDENTE 13 Apro~ 5811~ MICH~ Afil~ PART~ <NA> <NA> I <NA>
## 5 PRESIDENTE 13 Apro~ 5811~ MICH~ Afil~ PART~ <NA> <NA> I <NA>
## # ... with 9 more variables: ...12 <chr>, ...13 <chr>, ...14 <chr>,
## # ...15 <chr>, ...16 <chr>, ...17 <chr>, ...18 <chr>, ...19 <chr>,
## # ...20 <chr>
colnames(ingresos_candidatos_2_2013_sub) <- ingresos_candidatos_2_2013n
head(ingresos_candidatos_2_2013_sub,5)
## # A tibble: 5 x 20
## ELECCION REGION `ESTADO CUENTA` `RUN CANDIDATO` `NOMBRE DEL CAN~ FILIACIÓN
## <chr> <chr> <chr> <chr> <chr> <chr>
## 1 PRESIDE~ 13 Aprobada 5811892-3 MICHELLE BACHEL~ Afiliado
## 2 PRESIDE~ 13 Aprobada 5811892-3 MICHELLE BACHEL~ Afiliado
## 3 PRESIDE~ 13 Aprobada 5811892-3 MICHELLE BACHEL~ Afiliado
## 4 PRESIDE~ 13 Aprobada 5811892-3 MICHELLE BACHEL~ Afiliado
## 5 PRESIDE~ 13 Aprobada 5811892-3 MICHELLE BACHEL~ Afiliado
## # ... with 14 more variables: `NOMBRE DEL PARTIDO` <chr>, `NOMBRE DEL
## # PACTO` <chr>, `NOMBRE DEL SUBPACTO` <chr>, `TIPO PLANILLA` <chr>, `RUT O
## # RUN DEL DONANTE` <chr>, `NOMBRE DONANTE O INSTITUCIÓN FINANCIERA` <chr>,
## # `FECHA DOCUMENTO` <chr>, `TIPO DOCUMENTO` <chr>, DESCRIPCIÓN <chr>, `NUMERO
## # DOCUMENTO` <chr>, `TIPO CUENTA` <chr>, DESCRIPCIÓN <chr>, `GLOSA
## # DOCUMENTO` <chr>, MONTO <chr>
1 Eleccion a 2 nombre de partido b 3 RUT_tercero c 4 Nombre_tercero d
5 fecha_docu e 6 tipo_docu f 7 descripcion docu g
8 numero_doc h 9 tipo_cuenta i 10 descripcion tipo j 11 glosa_documento k 12 monto l 13 para reembolso m 14 anio n 15 tipo o
# colnames(lista_4gastos_candidatos_2_2009_sub)
colnames(ingresos_candidatos_2_2013_sub)
## [1] "ELECCION"
## [2] "REGION"
## [3] "ESTADO CUENTA"
## [4] "RUN CANDIDATO"
## [5] "NOMBRE DEL CANDIDATO"
## [6] "FILIACIÓN"
## [7] "NOMBRE DEL PARTIDO"
## [8] "NOMBRE DEL PACTO"
## [9] "NOMBRE DEL SUBPACTO"
## [10] "TIPO PLANILLA"
## [11] "RUT O RUN DEL DONANTE"
## [12] "NOMBRE DONANTE O INSTITUCIÓN FINANCIERA"
## [13] "FECHA DOCUMENTO"
## [14] "TIPO DOCUMENTO"
## [15] "DESCRIPCIÓN"
## [16] "NUMERO DOCUMENTO"
## [17] "TIPO CUENTA"
## [18] "DESCRIPCIÓN"
## [19] "GLOSA DOCUMENTO"
## [20] "MONTO"
lista_10ingresos_candidatos_2_2013_sub <- ingresos_candidatos_2_2013_sub[,c(1,7,11,12,13,14,15,16,17,18,19,20)]
lista_10ingresos_candidatos_2_2013_sub$"PARA REEMBOLSO" <- NA
lista_10ingresos_candidatos_2_2013_sub$ANIO <- 2013
lista_10ingresos_candidatos_2_2013_sub$TIPO <- "Ingreso"
# lista_7gastos_candidatos_2013_sub$"NOMBRE DEL PARTIDO" <- NA
# hay que aniadir "para reembolso", anio y tipo
# lista_6ingresos_candidatos_2_2009_sub <- lista_6ingresos_candidatos_2_2009_sub[,c(1,15,2,3,4,5,6,7,8,9,10,11,12,13,14)]
colnames(lista_10ingresos_candidatos_2_2013_sub)
## [1] "ELECCION"
## [2] "NOMBRE DEL PARTIDO"
## [3] "RUT O RUN DEL DONANTE"
## [4] "NOMBRE DONANTE O INSTITUCIÓN FINANCIERA"
## [5] "FECHA DOCUMENTO"
## [6] "TIPO DOCUMENTO"
## [7] "DESCRIPCIÓN"
## [8] "NUMERO DOCUMENTO"
## [9] "TIPO CUENTA"
## [10] "DESCRIPCIÓN"
## [11] "GLOSA DOCUMENTO"
## [12] "MONTO"
## [13] "PARA REEMBOLSO"
## [14] "ANIO"
## [15] "TIPO"
colnames(lista_10ingresos_candidatos_2_2013_sub) <- c("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o")
colnames(lista_10ingresos_candidatos_2_2013_sub)
## [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o"
# union_10 <- rbind(union_9,lista_10ingresos_candidatos_2_2013_sub)
# head(union_10,5)
gastos_candidatos_2017<- read_xlsx("Gastos_Primarias_2017_al_2017_09_29-1.xlsx")
## New names:
## * DV -> DV...5
## * DV -> DV...12
limite <- nrow(gastos_candidatos_2017)
head(gastos_candidatos_2017,5)
## # A tibble: 5 x 21
## ELECCION REGIÓN COMUNA `RUN\r\nCANDIDA~ DV...5 `NOMBRE DEL CAN~ FILIACIÓN
## <chr> <dbl> <chr> <dbl> <chr> <chr> <chr>
## 1 DIPUTADO 3 COPIA~ 16566719 0 JUAN MANUEL ANT~ Afiliado
## 2 DIPUTADO 4 LA SE~ 9686540 6 MARISOL CESPEDE~ Afiliado
## 3 DIPUTADO 4 LA SE~ 9686540 6 MARISOL CESPEDE~ Afiliado
## 4 DIPUTADO 4 LA SE~ 9686540 6 MARISOL CESPEDE~ Afiliado
## 5 DIPUTADO 4 LA SE~ 9686540 6 MARISOL CESPEDE~ Afiliado
## # ... with 14 more variables: `NOMBRE PARTIDO` <chr>, PACTO <chr>,
## # SUBPACTO <lgl>, `RUT O RUN\r\nDEL PROVEEDOR` <dbl>, DV...12 <chr>, `NOMBRE
## # PROVEEDOR` <chr>, `FECHA\r\nDOCUMENTO` <chr>, `TIPO\r\nDOCUMENTO` <chr>,
## # `DESCRIPCIÓN T/D` <chr>, `TIPO\r\nCUENTA` <dbl>, `DESCRIPCIÓN T/C` <chr>,
## # `NUMERO\r\nDOCUMENTO` <chr>, `GLOSA DOCUMENTO` <chr>, MONTO <dbl>
1 Eleccion a 2 nombre de partido b 3 RUT_tercero c 4 Nombre_tercero d
5 fecha_docu e 6 tipo_docu f 7 descripcion docu g
8 numero_doc h 9 tipo_cuenta i 10 descripcion tipo j 11 glosa_documento k 12 monto l 13 para reembolso m 14 anio n 15 tipo o
# colnames(lista_4gastos_candidatos_2_2009_sub)
colnames(gastos_candidatos_2017)
## [1] "ELECCION" "REGIÓN"
## [3] "COMUNA" "RUN\r\nCANDIDATO"
## [5] "DV...5" "NOMBRE DEL CANDIDATO"
## [7] "FILIACIÓN" "NOMBRE PARTIDO"
## [9] "PACTO" "SUBPACTO"
## [11] "RUT O RUN\r\nDEL PROVEEDOR" "DV...12"
## [13] "NOMBRE PROVEEDOR" "FECHA\r\nDOCUMENTO"
## [15] "TIPO\r\nDOCUMENTO" "DESCRIPCIÓN T/D"
## [17] "TIPO\r\nCUENTA" "DESCRIPCIÓN T/C"
## [19] "NUMERO\r\nDOCUMENTO" "GLOSA DOCUMENTO"
## [21] "MONTO"
lista_128gastos_candidatos_2017_sub <- gastos_candidatos_2017[,c(1,8,11,13,14,15,16,19,17,18,20,21)]
lista_128gastos_candidatos_2017_sub$"PARA REEMBOLSO" <- NA
lista_128gastos_candidatos_2017_sub$ANIO <- 2017
lista_128gastos_candidatos_2017_sub$TIPO <- "Gastos"
# lista_7gastos_candidatos_2013_sub$"NOMBRE DEL PARTIDO" <- NA
# hay que aniadir "para reembolso", anio y tipo
# lista_6ingresos_candidatos_2_2009_sub <- lista_6ingresos_candidatos_2_2009_sub[,c(1,15,2,3,4,5,6,7,8,9,10,11,12,13,14)]
colnames(lista_128gastos_candidatos_2017_sub)
## [1] "ELECCION" "NOMBRE PARTIDO"
## [3] "RUT O RUN\r\nDEL PROVEEDOR" "NOMBRE PROVEEDOR"
## [5] "FECHA\r\nDOCUMENTO" "TIPO\r\nDOCUMENTO"
## [7] "DESCRIPCIÓN T/D" "NUMERO\r\nDOCUMENTO"
## [9] "TIPO\r\nCUENTA" "DESCRIPCIÓN T/C"
## [11] "GLOSA DOCUMENTO" "MONTO"
## [13] "PARA REEMBOLSO" "ANIO"
## [15] "TIPO"
colnames(lista_128gastos_candidatos_2017_sub) <- c("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o")
colnames(lista_128gastos_candidatos_2017_sub)
## [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o"
union_17 <- readRDS("union_17.rds")
union_18 <- rbind(union_17,lista_128gastos_candidatos_2017_sub)
head(union_18,5)
## # A tibble: 5 x 15
## a b c d e f g h i j k l m
## <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
## 1 PRESI~ RENO~ 7622~ TRAN~ 38714 FA Fact~ 15 999 No d~ ARRD~ 3500~ C
## 2 PRESI~ PART~ - <NA> 38740 ND No d~ 1001 280 Gast~ GAST~ 0 <NA>
## 3 PRESI~ PART~ - <NA> 38727 ND No d~ 1000 280 Gast~ GAST~ 2036~ <NA>
## 4 PRESI~ PART~ 1453~ DANI~ 38731 FA Fact~ 368 210 Prop~ PUBL~ 7140~ <NA>
## 5 PRESI~ PART~ 9069~ EMPR~ 38730 FA Fact~ 1005~ 210 Prop~ CONF~ 9306~ C
## # ... with 2 more variables: n <dbl>, o <chr>