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
| require(dplyr) | |
| require(ggplot2) | |
| require(lubridate) | |
| require(scales) | |
| a <- c('2012-01-01') | |
| a2 <- ymd(a)+days(1:1000) | |
| a3 <- as.Date(a2) |
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
| baixa_prod_tjsp <- function(d, mes='9', ano='2011', id_vara='1') { | |
| curl <- getCurlHandle() | |
| aux <- curlSetOpt(cookiejar = tempfile(), useragent = "R", followlocation = TRUE, ssl.verifypeer = FALSE, curl = curl) | |
| url0 <- 'http://www.tjsp.jus.br/Institucional/CanaisComunicacao/Transparencia/Produtividade/Default.aspx' | |
| html0 <- getURL(url0, curl=curl) | |
| viewstate <- xmlGetAttr(getNodeSet(htmlParse(html0), "//input[@id='__VIEWSTATE']")[[1]], "value") | |
| eventval <- xmlGetAttr(getNodeSet(htmlParse(html0), "//input[@id='__EVENTVALIDATION']")[[1]], "value") | |
| post_var <- list('ctl00_ctl00_RadStyleSheetManagerportal_TSSM'=';|635458787180000000:2245c52c:8647d86b:6bfb0386:2c88367b:5c293c13:4405087d:c7942ac2:5aed19f8:55c8aca8:274b8a10:a7c49542:a1997d73:466a7156:33795bb3:ca77e845:4ad86637:a260866a;Telerik.Web.UI, Version=2014.1.403.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4:pt-BR:ca584452-327f-4858-bf00-fb22c6f6fd75:fe53831e:bc8339f7:1c2121e:e24b8e95', |
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(shiny) | |
| library(magrittr) | |
| shinyServer(function(input, output, session) { | |
| #__________________________________________________________________________________ | |
| # The main named list that will be used in many other tasks. | |
| listN <- list() | |
| #__________________________________________________________________________________ |
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(shiny) | |
| library(magrittr) | |
| shinyServer(function(input, output, session) { | |
| #__________________________________________________________________________________ | |
| # The main named list that will be used in many other tasks. | |
| #listN <- reactiveValues() | |
| #__________________________________________________________________________________ |
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(abjutils) | |
| library(tidyr) | |
| library(stringr) | |
| f <- download.file('https://dl.dropboxusercontent.com/u/44201187/dados.rds', method='wget', 'cc.rds') | |
| cc <- readRDS('cc.rds') | |
| cc <- cc %>% | |
| mutate(Municipio=str_trim(Municipio)) %>% | |
| unite(municipio_uf, Municipio, Estado, sep='@') |
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(httr) | |
| library(xml2) | |
| library(rvest) | |
| library(readxl) | |
| library(stringr) | |
| library(dplyr) | |
| library(ggplot2) | |
| library(purrr) | |
| library(stringdist) |
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(ggplot2) | |
| d <- data.frame( | |
| label = c('USA', 'IEM', 'FIN', 'SUI', 'IRQ', 'SER', 'FRA', 'CAN', 'SUE', 'AUS', 'BRA'), | |
| armas = c(90, 61, 55, 46, 39, 37.5, 32, 31.5, 31.5, 31, 8.8), | |
| homic = c(4.2, 4.2, 2.2, 0.7, 2.0, 1.2, 1.1, 1.6, 1.0, 0.6, 21.0) | |
| ) | |
| ggplot(d, aes(x = armas, y = homic, label = label)) + | |
| geom_text() + | |
| xlab('Armas por 100 mil habitantes') + | |
| ylab('Homicídios por 100 mil habitantes') |
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(rvest) | |
| library(httr) | |
| library(tidyr) | |
| library(dplyr) | |
| library(stringr) | |
| #' Tem captcha? | |
| #' | |
| #' Verifica se uma resposta tem captcha | |
| #' |
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(httr) | |
| library(rvest) | |
| library(dplyr) | |
| library(stringr) | |
| library(tidyr) | |
| universal_pags <- function() { | |
| universal_pag <- function(pag) { | |
| link <- sprintf('http://www.universal.org/enderecos/busca/brasil/todas/%04d/', pag) |
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(maptools) | |
| library(magrittr) | |
| library(getcartr) | |
| library(ggplot2) | |
| desacentuar <- function(x) { | |
| gsub("`|\\'", "", iconv(x, to = "ASCII//TRANSLIT")) | |
| } | |
| ############################################################################### |