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
### calculando margem de erro | |
# p = probabilidade | |
# n = tamanho da amostra | |
# z = 1.96 para 95% de confiança em um teste bicaudal | |
# base = 1 para probabilidades de 0 a 1, ou 100 para probabilidades de 0 a 100 | |
margem <- function(p, n, z=1.96, base=1) { | |
Margem = z * base * sqrt((p/base * (1-(p/base)))/n) | |
return(Margem) |
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
## Code to generate divida liquida plots | |
# Library ----------------------------------------------------------------- | |
library(tidyverse) | |
library(readxl) | |
library(lubridate) | |
# Data -------------------------------------------------------------------- |
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(readxl) | |
library(tidyverse) | |
library(ggrepel) | |
# Data ------------------------------------------------------------------- | |
# data here https://docs.google.com/spreadsheets/d/11bv5VB6Hyz0BeWBWPiVoE-mlvOm9kB6jbCHGdjaz27Q/edit?usp=sharing | |
gini <- read_excel("~/Downloads/gini.xlsx", sheet="Sheet4") | |
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
# Setwd ------------------------------------------------------------------- | |
setwd("605. Picadas de animais/") | |
# Libraries --------------------------------------------------------------- | |
library(tidyverse) | |
library(readxl) |
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
# Libraries --------------------------------------------------------------- | |
library(congressbr) | |
library(tidyverse) | |
library(lubridate) | |
# Bills ------------------------------------------------------------------- |
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
#--- libraries | |
library(readxl) | |
library(sf) | |
library(tidyverse) | |
#--- data | |
pib <- read_excel("pib.xlsx") %>% | |
mutate(code = as.numeric(code)) |
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
##-- GABRIEL ZANLORENSSI | |
##-- 01/04/2020 | |
# Bibliotecas ------------------------------------------------------------- | |
library(readxl) | |
library(tidyverse) | |
library(lubridate) |
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
# Bibliotecas ------------------------------------------------------------- | |
library(tidyverse) | |
library(sf) | |
library(sp) | |
library(rgeos) | |
# devtools::install_github("Nexo-Dados/nexo.utils") | |
library(nexo.utils) | |
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
# 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) |
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
#-- 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", |
OlderNewer