read.table(file, header = FALSE, sep = "“, quote =”"’“, dec =”.“, numerals = c(”allow.loss“,”warn.loss“,”no.loss“), row.names, col.names, as.is = !stringsAsFactors, na.strings =”NA", …
Download do arquivo [https://tinyurl.com/Int-R01-zip]
1- Sejam os vetores: x=rnorm(10) e y=rnorm(10,30), crie um objeto com x e y em duas colunas e nomeie como M. Exporte este objeto com write.csv(M,“M.csv”)e write.csv2 (M,“M2.csv”).
3- Carregue o arquivo renda_BR_02

> MORADOR <-
+ read.fwf("../pof/MORADOR.txt"
+ , widths = c(2,4,1,9,2,1,2,2,1,2,2,4,3,1,1,14,14,10)
+ , na.strings=c(" ")
+ , col.names = c("UF"
+ , "ESTRATO_POF", "TIPO_SITUACAO_REG"
+ , "COD_UPA", "NUM_DOM", "NUM_UC"
+ , "COD_INFORMANTE", "V0306", "V0401"
+ , "V04021", "V04022", "V04023", "V0403"
+ , "V0404", "V0405", "PESO", "PESO_FINAL"
+ , "RENDA_TOTAL")
+ , dec="."
+ )
>
> > w=c(2,4,1,9,2,1,2,2,1,2,2,4,3,1,1,14,14,10)
> end1=cumsum(x)
> start1=end1-(x-1)
> vars = c("UF", "ESTRATO_POF", "TIPO_SITUACAO_REG"
+ , "COD_UPA", "NUM_DOM", "NUM_UC"
+ , "COD_INFORMANTE", "V0306", "V0401"
+ , "V04021", "V04022", "V04023", "V0403"
+ , "V0404", "V0405", "PESO", "PESO_FINAL"
+ , "RENDA_TOTAL")
>
> MORADOR = readr::read_fwf("../pof/MORADOR.txt"
+ ,col_positions = readr::fwf_widths(w, vars) )
> 

> library(PNADcIBGE)
> input_path <- pnadc_example(path="input_example.txt")
> data_path <- pnadc_example(path="exampledata.txt")
> pnadc.df <- read_pnadc(microdata=data_path,
+ input_txt=input_path, vars="VD4002")
>
> head(pnadc.df,3)
## # A tibble: 3 x 9
## Ano Trimestre
## <chr> <chr>
## 1 2017 4
## 2 2017 4
## 3 2017 4
## # ... with 7 more
## # variables:
## # UF <chr>,
## # UPA <chr>,
## # Estrato <chr>,
## # V1027 <dbl>,
## # V1029 <dbl>,
## # posest <chr>,
## # VD4002 <chr>