Skip to content

Commit

Permalink
pns draft
Browse files Browse the repository at this point in the history
  • Loading branch information
ajdamico committed Sep 5, 2023
1 parent 6faabdf commit ff4db6a
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions tests/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
dictionary_tf <- tempfile()

dictionary_url <-
paste0(
"https://ftp.ibge.gov.br/PNS/" ,
"2019/Microdados/Documentacao/" ,
"Dicionario_e_input_20220530.zip"
)
"https://ftp.ibge.gov.br/PNS/2019/Microdados/Documentacao/Dicionario_e_input_20220530.zip"

download.file( dictionary_url , dictionary_tf , mode = 'wb' )

Expand All @@ -29,7 +25,7 @@ sas_lines <- sas_lines[ seq( sas_start , sas_end - 1 ) ]
sas_lines <- gsub( "\\/\\*(.*)" , "" , sas_lines )

# remove tabs, multiple spaces and spaces at the end of each string
sas_lines <- gsub( " " , " " , sas_lines )
sas_lines <- gsub( "\t" , " " , sas_lines )
sas_lines <- gsub( "( +)" , " " , sas_lines )
sas_lines <- gsub( " $" , "" , sas_lines )

Expand All @@ -54,11 +50,7 @@ stopifnot(
this_tf <- tempfile()

this_url <-
paste0(
"https://ftp.ibge.gov.br/PNS/" ,
"2019/Microdados/Dados/" ,
"PNS_2019_20220525.zip"
)
"https://ftp.ibge.gov.br/PNS/2019/Microdados/Dados/PNS_2019_20220525.zip"

download.file( this_url , this_tf , mode = 'wb' )
library(readr)
Expand Down Expand Up @@ -114,8 +106,6 @@ pns_design <-
update(
pns_design ,

one = 1 ,

medical_insurance = ifelse( i00102 %in% 1:2 , as.numeric( i00102 == 1 ) , NA ) ,

uf_name =
Expand Down

0 comments on commit ff4db6a

Please sign in to comment.