library(dplyr) library(xtable) library(microdadosBrasil) library(printr) library(knitr) knitr::opts_chunk$set(echo = FALSE)
read_data
microdadosBrasil
# github.com/lucasmation/microdadosBrasil # README_PT.md : documentação em português # Instalação: devtools::install_github("lucasmation/microdadosBrasil")
knitr::include_graphics("images/image2.PNG")
Encontrar versão oficial
Txt colunado( fixed width files)
Falta de harmonização entre os anos
Dados grandes subdivididos em muitos arquivos
knitr::include_graphics("images/download_pnad.PNG")
knitr::include_graphics("images/planilha_fwf.png")
vars_width <- c(4,8,3,2,1,2,2,4,3,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1, 1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1, 1,1,1,4,5,1,4,5,1,1,12,1,12,1,1,2,1,2,1,1,1,1,1,1,4,5,2,1,1,1,1,1, 1,1,11,7,1,11,7,1,11,7,1,1,1,1,1,11,7,1,11,7,1,11,7,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,12,1,12,1,1,1,1,1, 1,1,1,2,1,1,2,2,1,1,2,1,1,1,1,1,1,4,5,2,1,1,1,1,1,1,1,1,1,1,1,1, 2,2,1,1,1,2,4,5,1,1,1,1,1,1,1,12,1,12,1,1,1,2,1,12,1,12,1,1,1,1,2,1, 1,1,2,2,4,5,1,1,1,1,1,1,1,1,1,1,2,1,1,1,2,12,2,12,2,12,2,12,2,12,2,12, 2,12,2,12,1,1,2,2,2,2,1,1,2,2,1,1,1,2,4,1,1,2,2,1,1,1,2,2,2,1,1,2 ,1,1,2,2,1,1,1,1,2,2,2,12,12,12,12,12,2,2,1,1,5,5,1,1,1,2,12,2,1,1,1,1 ,1,12,8)
data_path<- paste0("C:/Users/Nícolas/Documents/", "PNAD_reponderado_2011_20150814/2011/Dados")
vars<- c("V0101","V0102","V0103","V0301","V0302","V3031","V3032","V3033","V8005","V0401", "V0402","V0403","V0404","V0405","V0406","V0407","V0408","V0409","V0410","V4111", "V4112","V4011","v0412","V0501","V0502","V5030","V0504","V0505","V5061","V5062", "V5063","V5064","V5065","V0507","V5080","V5090","V0510","V0511","V5121","V5122", "V5123","V5124","V5125","V5126","V0601","V0602","V6002","V6020","V6003","V6030", "V0604","V0605","V0606","V6007","V6070","V0608","V0609","V0610","V0611","V06111", "V06112" "V0612","V0701","V0702","V0703","V0704","V0705","V7060","V7070","V0708", "V7090","V7100","V0711","V7121","V7122","V7124","V7125","V7127","V7128","V0713", "V0714","V0715","V0716","V9001","V9002","V9003","V9004","V9005","V9906","V9907", "V9008","V9009","V9010","V9011","V9012","V9013","V9014","V9151","V9152","V9154", "V9156","V9157","V9159","V9161","V9162","V9164","V9016","V9017","V9018","V9019", "V9201","V9202","V9204","V9206","V9207","V9209","V9211","V9212","V9214","V9021", "V9022","V9023","V9024","V9025","V9026","V9027","V9028","V9029","V9030","V9031", "V9032","V9033","V9034","V9035","V9036","V9037","V9038","V9039","V9040","V9041", "V9042","V9043","V9044","V9045","V9046","V9047","V9048","V9049","V9050","V9051", "V9052","V9531","V9532","V9534","V9535","V9537","V90531","V90532","V90533","V9054", "V9055","V9056","V9057","V9058","V9059","V9060","V9611","V9612","V9062","V9063", "V9064","V9065","V9066","V9067","V9068","V9069","V9070","V9971","V9972","V9073", "V9074","V9075","V9076","V9077","V9078","V9079","V9080","V9081","V9082","V9083", "V9084","V9085","V9861","V9862","V9087","V9088","V9891","V9892","V9990","V9991", "V9092","V9093","V9094","V9095","V9096","V9097","V9981","V9982","V9984","V9985", "V9987","V9099","V9100","V9101","V1021","V1022","V1024","V1025","V1027","V1028", "V9103","V9104","V9105","V9106","V9107","V9108","V1091","V1092","V9910","V9911", "V9112","V9113","V9114","V9115","V9116","V9117","V9118","V9119","V9120","V9121", "V9921","V9122","V9123","V9124","V1251","V1252","V1254","V1255","V1257","V1258", "V1260","V1261","V1263","V1264","V1266","V1267","V1269","V1270","V1272","V1273", "V9126","V1101","V1141","V1142","V1151","V1152","V1153","V1154","V1161","V1162", "V1163","V1164","V1107","V1181","V1182","V1109","V1110","V1111","V1112","V1113", "V1114","v1115","V4801","V4802","V4803","V4704","V4805","V4706","V4707","V4808", "V4809","V4810","V4711","V4812","V4713","V4814","V4715","V4816","V4817","V4718", "V4719","V4720","V4721","V4722","V4723","V4724","V4727","V4728","V4729","V4732", "V4735","V4838","V6502","V4741","V4742","V4743","V4745","V4746","V4747","V4748", "V4749","V4750","V9993")
d<- read.fwf(file = paste0(data_path, "PES2011.txt"), widths = vars_width, col.names = vars)
download_sourceData(dataset = "PNAD", i = 2011, unzip = T) d<- read_PNAD(ft = "pessoas", i = 2011)
download_sourceData(dataset = "CensoEscolar", i = 2000, unzip = T) d<- read_CensoEscolar(ft = "escola", i = 2000)
knitr::include_graphics("images/cupcakes_vanilla1.PNG")
knitr::include_graphics("images/cupcakes_vanilla1.PNG")
knitr::include_graphics("images/Chocolate_cupcakes.JPG")
knitr::include_graphics("images/Chocolate_cupcakes2.JPG")
knitr::include_graphics("images/vanilla_cupcakes2.JPG")
knitr::include_graphics("images/Vanilla_cupcakes3.JPG")
knitr::include_graphics("images/Vanilla_cupcakes4.JPG")
knitr::include_graphics("images/capcakes_van_choc.JPG")
knitr::include_graphics("images/capcakes_van_choc2.JPG")
csv_file<- read.csv("examples/template_csv.csv", sep = ";") x<- head(csv_file %>% select(1:5)) %>% xtable(align = rep("c",6)) print(x, type = "html")
csv_file<- read.csv("examples/template_csv.csv", sep = ";") knitr::kable(head(csv_file %>% select(6:7)),format = "html")
csv_file<- read.csv("examples/template_csv.csv", sep = ";") knitr::kable(head(csv_file %>% select(8:9)),format = "html")
csv_file<- read.csv("examples/template_csv.csv", sep = ";") knitr::kable(head(csv_file %>% select(6:9)),format = "html")
str(PNAD_dics[1:3] ,max.level = 2)
get_import_dictionary("CensoEscolar", 2000, 'escola')
get_import_dictionary("CensoEscolar", 2000, 'escola') %>% head %>% xtable(digits = 0, align = rep("c",10)) -> x print(x, type = "html")
read_data
{.build}read_data(dataset, ft, i, metadata = NULL, dic_list = NULL, var_translator = NULL, root_path = NULL, file = NULL )
read_data
{.build}read_data
{.build}data.frame
contendo as informações necessárias para a leitura da base de dados, se = NULL
é utilizada a tabela encontrada pelo nome padrão do arquivo inst/extadata/dataset_files_harmonization.csv
root_path
lê direto o arquivo indicado,read_data
em argumentos mais amigáveis ao usuário.read_PNAD<- function(ft,i,root_path=NULL,file = NULL){ data<-read_data(dataset = "PNAD", ft, i, root_path = root_path, file = file)
download_sourceData(dataset = "PNAD", i = 2012, unzip = T)
parses_SAS_import_dic(file = "DICIONARIO.SAS")
get_import_dictionary("CensoEscolar", 2000, 'escola') %>% head %>% kable(format = "html")
packages<- read.csv("examples/comparacao_pacotes.csv", sep = ";", row.names = 1) kable(packages, format = "html")
packages<- read.csv("examples/comparacao_pacotes2.csv", sep = ";") kable(packages, format = "html")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.