class: center, middle, inverse, title-slide # .text-hl[transpbrr] ## UserRS ###
Lucas da Cunha Godoy
Augusto Marcolin
###
2019/02/06 --- class: middle bg-main1 hide-slide-number .outline[ ## Outline * Introdução * O Pacote * Exemplo * Conclusão ] --- class: bg-main1 split-30 hide-slide-number .column.bg-main3[ ] .column.slide-in-right[ .sliderbox.bg-main2.vmiddle[ .font5[Intro] ]] --- class: middle center bg-main1 # Quem sou .text-hl[eu]? -- <br> ## Bel. Estatística - UFRGS ## Me. Estatística - UFMG
## Data Scientist - Agibank --- class: middle center bg-main2 # Motivação --- class: middle center <div align="center"> <img src="img/s4g.jpg" height="80%" width="80%" /> </div> --- class: middle center bg-main2 .outline[ ## Objetivos .text-hl[S4G] * Compartilhar conhecimento * Maior interação entre estudantes * Dois projetos: [GESEM](stats4good.github.io/gesem) e [Veraz](stats4good.github.io/veraz) ] --- class: middle center bg-main3 background-image: url("img/veraz.png") --- class: split-two .column.bg-main1[ .split-two[ .row.bg-main1[.content.vmiddle.center[ # Despesas ]] .row.bg-main2[.content.vmiddle.center[ # Servidores ]] ]] .column.bg-main1[ .split-two[ .row.bg-main2[.content.vmiddle.center[ # Receitas ]] .row.bg-main1[.content.vmiddle.center[ # Convênios ]] ]] --- class: split-two fade-row2-col1 fade-row2-col2 fade-row1-col2 count: false .column.bg-main1[ .split-two[ .row.bg-main1[.content.vmiddle.center[ # Despesas ]] .row.bg-main2[.content.vmiddle.center[ # Servidores ]] ]] .column.bg-main1[ .split-two[ .row.bg-main2[.content.vmiddle.center[ # Receitas ]] .row.bg-main1[.content.vmiddle.center[ # Convênios ]] ]] --- class: middle center bg-main3 background-image: url("img/port_transp.png") --- class: bg-main1 split-30 hide-slide-number .column.bg-main3[ ] .column.slide-in-right[ .sliderbox.bg-main2.vmiddle[ .font5[[transpbrr](https://stats4good.github.io/transpbrr/)] ]] --- class: middle center bg-main3 # .text-hl[Codigo] --- class: middle ```r download_orcamento <- function(year = NULL, ...) { if(any(!is.numeric(year)) | any(!year %in% 2014:as.numeric(format(Sys.Date(), '%Y')))) stop('Year must be a integer value between 2014 and 2018.') temp_dir <- tempdir() link <- ('http://www.portaltransparencia.gov.br/download-de-dados/orcamento-despesa/%d') lapply(list.files(path = temp_dir, pattern = '.csv$', full.names = T), file.remove) %>% invisible() ... ``` --- class: middle ```r ... for(i in year) { file_name <- paste0(sprintf('orcamento_%d', i), '.zip') dest <- file.path( temp_dir, file_name) file.create(dest) utils::download.file(url = sprintf(link, i), destfile = dest, quiet = T, mode = 'wb') if(.Platform$OS.type == "windows") { utils::unzip(zipfile = dest, exdir = temp_dir, unzip = 'internal') } else { utils::unzip(zipfile = dest, exdir = temp_dir) } } ... ``` --- class: middle ```r ... out <- lapply(list.files(path = temp_dir, pattern = '.csv$', full.names = T), function(x) { aux <- suppressWarnings(data.table::fread(x, dec = ',', sep = ';', encoding = 'Latin-1', stringsAsFactors = F)) names(aux) <- trimws(iconv(names(aux), from = 'LATIN1', to = 'ASCII//TRANSLIT'), 'b') char_fct <- which(sapply(aux, is.character)) aux[, c(char_fct) := lapply(.SD, function(x) { iconv(x, from = 'LATIN1', to = 'ASCII//TRANSLIT') }), .SDcols = char_fct] aux }) %>% data.table::rbindlist() unlink(list.files(temp_dir, full.names = T), recursive = T) return(out) } ``` --- class: bg-main1 split-30 hide-slide-number .column.bg-main3[ ] .column.slide-in-right[ .sliderbox.bg-main2.vmiddle[ .font5[Exemplo] ]] --- class: bg-main3 middle center # .text-hl[Hands on] --- class: bg-main1 split-30 hide-slide-number .column.bg-main3[ ] .column.slide-in-right[ .sliderbox.bg-main2.vmiddle[ .font5['Conclusão'] ]] --- class: bg-main3 # .text-hl[TO DO] * Servidores * .text-hl[Licitações e Contratos] * Viagens a serviço (Melhoramentos) * Benefícios ao cidadão - Garantia Safra - Seguro defeso (Pescador artesanal) - Erradicação do Trabalho Infantil (PETI) * Sanções * Criar documentação completa em português e inglês --- class: bg-main5 middle center hide-slide-number #
lucasdac.godoy@gmail.com # [
](https:://github.com/lcgodoy) github.com/lcgodoy # [
](https:://lcgodoy.github.io) lcgodoy.github.io