# Using data read from disk
input_path <- pns_example(path="input_example.txt")
data_path <- pns_example(path="exampledata.txt")
dictionary.path <- pns_example(path="dictionaryexample.xls")
deflator.path <- pns_example(path="deflatorexample.xls")
pns.df <- read_pns(microdata=data_path, input_txt=input_path, vars=c("J007","J009"))
pns.df <- pns_labeller(data_pns=pns.df, dictionary.file=dictionary.path)
pns.df <- pns_deflator(data_pns=pns.df, deflator.file=deflator.path)
# \donttest{
pns.svy <- pns_design(data_pns=pns.df)
# Calculating proportion of people diagnosed with chronic diseases
if (!is.null(pns.svy)) survey::svymean(x=~J007, design=pns.svy, na.rm=TRUE)# }
# \donttest{
# Downloading data
pns.df2 <- get_pns(year=2019, selected=FALSE, anthropometry=FALSE, vars=c("J007","J009"),
labels=TRUE, deflator=TRUE, design=FALSE,
reload=TRUE, curlopts=list(), savedir=tempdir())
pns.svy2 <- pns_design(data_pns=pns.df2)
# Calculating proportion of people diagnosed with chronic diseases
if (!is.null(pns.svy2)) survey::svymean(x=~J007, design=pns.svy2, na.rm=TRUE)# }
Run the code above in your browser using DataLab