parse_meta.RdParse dataset metadata
parse_dcf(dcf, all_lower = TRUE) parse_sps(sps, all_lower = TRUE) parse_do(do, dct, all_lower = TRUE)
| dcf | .DCF file path to parse |
|---|---|
| all_lower | logical indicating whether to convert variable labels to lower case. Defaults to `TRUE`. |
| sps | .SPS file as character vector (e.g. from readLines) |
| do | .DO file as character vector (e.g. from readLines) |
| dct | .DCT file as character vector (e.g. from readLines) |
data.frame with metadata for parsing fixed-width flat file
mrfl_zip <- tempfile() download.file( paste0( "https://dhsprogram.com/customcf/legacy/data/sample_download_dataset.cfm?", "Filename=ZZMR61FL.ZIP&Tp=1&Ctry_Code=zz&survey_id=0&doctype=dhs"), mrfl_zip, mode="wb" ) dcf <- rdhs::read_zipdata(mrfl_zip, "\\.DCF", readLines) dct <- rdhs:::parse_dcf(dcf) sps <- rdhs::read_zipdata(mrfl_zip, "\\.SPS", readLines) dct <- rdhs:::parse_sps(sps) do <- rdhs::read_zipdata(mrfl_zip, "\\.DO", readLines) dctin <- rdhs::read_zipdata(mrfl_zip, "\\.DCT", readLines) dct <- rdhs:::parse_do(do, dctin)