Last active
March 31, 2021 17:38
-
-
Save jsajuria/47e6be886ff1eaf27eb1c3a799889d5f to your computer and use it in GitHub Desktop.
Aportes por pacto a la CC
This file contains hidden or 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
# Primero bajen la base del servel desde https://repodocgastoelectoral.blob.core.windows.net/public/Reporte_Aportes_Abonados_CC_GORE_MUNICIPALES.xlsx | |
# y borren las primeras líneas (lo siento, no alcancé a automatizar esto) | |
library(haven) | |
library(readxl) | |
library(tidyverse) | |
library(hrbrthemes) | |
base_cc <- read_excel("Reporte_Aportes_Abonados_CC_GORE_MUNICIPALES.xlsx") | |
names(base_cc) | |
APORTES_POR_PACTO <- base_cc %>% filter(ELECCION == "CONVENCIONALES CONSTITUYENTES", `TIPO DE APORTE` != "ANTICIPO FISCAL") %>% group_by(PACTO, PARTIDO) %>% summarise(monto = sum(MONTO)) | |
APORTES_POR_PACTO <- APORTES_POR_PACTO %>% mutate(pacto_agregado = case_when(PACTO == "APRUEBO DIGNIDAD" ~ "APRUEBO DIGNIDAD", | |
PACTO == "ELIGE LA LISTA DEL PUEBLO (D23)" ~ "LISTA DEL PUEBLO", | |
PACTO == "INDEPENDIENTES DISTRITO 6 + LISTA DEL PUEBLO (D6)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LA LISTA DEL PUEBLO (D10)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LA LISTA DEL PUEBLO (D13)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LA LISTA DEL PUEBLO (D17)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LA LISTA DEL PUEBLO (D3)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LA LISTA DEL PUEBLO (D7)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LA LISTA DEL PUEBLO (D8)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LA LISTA DEL PUEBLO 100% INDEPENDIENTES (D15)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LA LISTA DEL PUEBLO DISTRITO 12 (D12)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LA LISTA DEL PUEBLO DISTRITO 14 (D14)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LA LISTA DEL PUEBLO DISTRITO 9 (D9)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LA LISTA DEL PUEBLO MAULE SUR (D18)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LA LISTA DEL PUEBLO(D20)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LISTA DEL PUEBLO-RIOS INDEPENDIENTES (D24)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LISTA DEL PUEBLO - MOVIMIENTO TERRITORIAL CONSTITUYENTE (D5)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LISTA DEL PUEBLO TRANSFORMANDO DESDE EL WILLI (D25)" ~ "LISTA DEL PUEBLO", | |
PACTO == "LISTA DEL APRUEBO" ~ "LISTA DEL APRUEBO", | |
PACTO == "VAMOS POR CHILE" ~ "VAMOS POR CHILE", | |
PARTIDO == "EVOLUCION POLITICA" ~ "VAMOS POR CHILE", | |
PARTIDO == "UNION DEMOCRATA INDEPENDIENTE" ~ "VAMOS POR CHILE", | |
PARTIDO == "RENOVACION NACIONAL" ~ "VAMOS POR CHILE", | |
PARTIDO == "PARTIDO SOCIALISTA DE CHILE" ~ "LISTA DEL APRUEBO", | |
PARTIDO == "PARTIDO LIBERAL DE CHILE" ~ "LISTA DEL APRUEBO", | |
PARTIDO == "PARTIDO DEMOCRATA CRISTIANO" ~ "LISTA DEL APRUEBO", | |
PARTIDO == "CIUDADANOS" ~ "LISTA DEL APRUEBO", | |
PARTIDO == "COMUNES" ~ "APRUEBO DIGNIDAD", | |
PARTIDO == "CONVERGENCIA SOCIAL" ~ "APRUEBO DIGNIDAD", | |
PARTIDO == "PARTIDO COMUNISTA DE CHILE" ~ "APRUEBO DIGNIDAD", | |
TRUE ~ "Independientes y otros pactos menores")) %>% | |
mutate(pacto_agregado = factor(pacto_agregado, levels = c("VAMOS POR CHILE", "LISTA DEL APRUEBO", "APRUEBO DIGNIDAD", "LISTA DEL PUEBLO", "Independientes y otros pactos menores"))) | |
APORTES_POR_PACTO %>% group_by(pacto_agregado) %>% summarise(monto = sum(monto)) %>% | |
ggplot(aes(y = monto, x = pacto_agregado, fill = pacto_agregado)) + geom_col() + | |
theme_ipsum_rc() + scale_x_discrete(labels = "", breaks = "")+ | |
scale_y_continuous(breaks = seq(0,4000000000, by = 500000000), | |
labels = c("0", "500M", "1000M", "1500M", "2000M", "2500M", "3000M", "3500M", "4000M"), | |
limits = c(0,4000000000)) + | |
scale_fill_discrete(name = "Pactos") + | |
labs(title = "Aportes recibidos por pacto", subtitle = "Convención Constituyente (al 26 de marzo de 2021)", | |
y = "Monto", x = "") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment