Skip to content

Instantly share code, notes, and snippets.

View gabrielzanlorenssi's full-sized avatar
🐊

Gabriel Zanlorenssi gabrielzanlorenssi

🐊
View GitHub Profile
# Resultados copa ---------------------------------------------------------
library(tidyverse)
library(readxl)
library(googlesheets4)
url = "https://docs.google.com/spreadsheets/d/1m9fPRyk5fNVP7CXuVw2MqF3ZGAMbFFhceTsEoYSCUy4/edit#gid=0"
sheets <- read_sheet(url)
# Pacotes -----------------------------------------------------------------
library(tidyverse)
library(jsonlite)
# Configurar --------------------------------------------------------------
#-- codigo pleito
# pleito = 544 # 1t !! (usar esse para teste) !!
# Pacotes -----------------------------------------------------------------
library(tidyverse)
library(jsonlite)
# Configurar --------------------------------------------------------------
#-- codigo pleito
# Pacotes -----------------------------------------------------------------
library(tidyverse)
library(jsonlite)
# Configuracao dos municipios ---------------------------------------------
urlm = "https://resultados.tse.jus.br/oficial/ele2022/544/config/mun-e000544-cm.json"
library(rvest)
library(tidyverse)
#-- links
url = "https://www.camara.leg.br/internet/sitaqweb/resultadoPesquisaDiscursos.asp?txIndexacao=&CurrentPage=19&BasePesq=plenario&txOrador=JAIR%20BOLSONARO&txPartido=&dtInicio=&dtFim=&txUF=&txSessao=&listaTipoSessao=&listaTipoInterv=&inFalaPres=&listaTipoFala=&listaFaseSessao=&txAparteante=&listaEtapa=&CampoOrdenacao=dtSessao&TipoOrdenacao=DESC&PageSize=50&txTexto=&txSumario="
url %>%
read_html(url) %>%
html_nodes("a") %>%
# Bibliotecas -------------------------------------------------------------
library(tidyverse)
library(sf)
library(jsonlite)
# Configuracao dos municipios ---------------------------------------------
urlm = "https://resultados.tse.jus.br/oficial/ele2022/544/config/mun-e000544-cm.json"
muni_tse <- fromJSON(urlm,
# Library -----------------------------------------------------------------
library(cepespR)
library(tidyverse)
#-- 1998 a 2018
years <- c(1998, 2002, 2006, 2010, 2014, 2018)
d <- map_df(years, function(x) {
get_votes(year=x, position="President") %>%
#-- exemplo
cidade = "SÃO PAULO"
uf = "SP"
final %>%
mutate(partido = case_when(partido %in% c("PT", "PSDB", "PSOL") ~ partido,
numero_cand == 17 & year==2018 ~ "Bolsonaro",
numero_cand == 20 & year==1989 ~ "Collor",
numero_cand == 12 & year<1998 ~ "Brizola",
@gabrielzanlorenssi
gabrielzanlorenssi / codigo_ipec.r
Last active September 5, 2022 01:16
codigo_pesquisas_ipec
# atenção: código escrito rapidamente. não foi revisado para deixar mais legível
# Library -----------------------------------------------------------------
library(tidyverse)
library(sf)
library(readxl)
library(googlesheets4)
library(geobr)
@gabrielzanlorenssi
gabrielzanlorenssi / codigo.r
Created March 29, 2021 19:50
Código de R para calcular a extensão das fronteiras dos estados brasileiros
# Bibliotecas -------------------------------------------------------------
library(tidyverse)
library(sf)
library(sp)
library(rgeos)
# devtools::install_github("Nexo-Dados/nexo.utils")
library(nexo.utils)