Skip to content

Instantly share code, notes, and snippets.

@pmarkun
pmarkun / processa.r
Created October 14, 2018 14:59
processa dados de boletim de urna e gera mapas eleitorais
require(ff)
require(ffbase)
require(data.table)
# lê e processa boletins de urna
# http://www.tse.jus.br/hotsites/pesquisas-eleitorais/resultados_anos/boletim_urna/2018/boletim_urna_1_turno.html
log_path = "~/devel/mapadevotos2018/bweb_1t_'SP_101020182030.csv"
data <- read.table.ffdf(file=log_path,
FUN="read.csv2",
library(ggplot2)
library(dplyr)
# http://www.tse.jus.br/eleicoes/estatisticas/repositorio-de-dados-eleitorais-1/repositorio-de-dados-eleitorais
# http://agencia.tse.jus.br/estatistica/sead/odsele/detalhe_votacao_munzona/detalhe_votacao_munzona_2014.zip
data <- read.csv2(file="~/devel/rexperiments/eleicoes/data/2014/detalhe_munzona/detalhe_votacao_munzona_2014_BR.txt",
sep=";",
header = FALSE,
encoding = "Latin-1")
var DDPClient = require("ddp");
var ddpclient = new DDPClient({
// All properties optional, defaults shown
host : "localhost",
port : 3000,
ssl : false,
autoReconnect : true,
autoReconnectTimer : 500,
maintainCollections : true,
first_nome media count genero
1 RICARDO 10918.6412670514 3812 male
2 ALEXANDRE 10877.9132166099 3227 NA
3 MARCELO 10840.7404954013 4784 male
4 EDUARDO 10810.7099511915 3483 male
5 SERGIO 10760.0987005823 3263 male
6 MAURO 10548.3422007042 1136 NA
7 FLAVIO 10491.3896149144 1636 NA
8 MARCO 10465.7687653007 1879 male
9 GUSTAVO 10457.9929548023 1770 male
@pmarkun
pmarkun / teste.js
Last active November 11, 2016 17:56
texto = "texto com varias palavras inclusive texto"
texto = texto.replace(\[^\w\s]\g, " ")
texto = texto.split(" ")
dicionario = {}
for (l in texto) {
dicionario[texto[l]] = dicionario[texto[l]] || 0;
dicionario[texto[l]] += 1
}
library(htmltab)
library(dplyr)
library(tidyr)
library(gsubfn)
library(data.table)
library(ggmap)
library(ggplot2)
library(maptools)
library(rgdal)
library(htmltab)
library(dplyr)
library(tidyr)
library(gsubfn)
library(data.table)
library(nominati)
if(!file.exists('secoes_eleitorais.rds')) {
require(dplyr)
library(rgdal)
library(ggplot2)
library(maptools)
library(scales)
library(data.table)
gpclibPermit()
shape <- readOGR("/home/markun/devel/eleicoes2016/shape", "zonaseleitorais2")
---
title: "Tempo de Vereança"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(timeline)
library(dplyr)
library(googleVis) ## googleVis 0.5.0-3
library(dplyr)
library(stringr)
autor_sample = "TipoProj#NoProj#DataProj#Autor
pl#1#07/01/1948#JOSE DE MOURA, PARTIDO REPUBLICANO
pl#2#19/01/1948#REINALDO SMITH DE VASCONCELOS, PSP
pl#2#19/01/1948#E OUTROS
pl#3#19/01/1948#ROBERTO GRASSI, PTN
pl#4#26/01/1948#ROBERTO GRASSI, PTN"