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
# Library | |
library(networkD3) | |
library(dplyr) | |
# Cargar la base con origen y destino | |
links <- read.csv("https://www.sajuria.com/files/jilescsv.csv") | |
# Crear los nodos de la red | |
nodes <- data.frame( |
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") |
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
library(tidyverse) | |
library(hrbrthemes) | |
library(truncnorm) | |
set.seed(100) | |
psu <- data.frame(puntaje = rtruncnorm(10000,150,850,500,110)) | |
#baseline | |
p <- ggplot(psu, aes(x=puntaje)) | |
# Linea de promedio y ejes |
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
library(texreg) | |
library(haven) | |
library(hrbrthemes) | |
library(ggrepel) | |
dat <- read_csv("controles_comunas.csv") ## Pueden bajar el archivo en el Gist | |
mod1 <- lm(controles ~ poly(poblacion,1) + poly(pobreza,2), dat) | |
screenreg(mod1) |