Learn R Programming

rdhs (version 0.8.1)

parse_map: Create dictionary from DHS .MAP codebook

Description

Create dictionary from DHS .MAP codebook

Usage

parse_map(map, all_lower = TRUE)

Value

A data frame containing metadata, principally variable labels and a vector of value labels.

Arguments

map

A character vector containing .MAP file, e.g. from `readLines()`.

all_lower

Logical indicating whether all value labels should be converted to lower case

Details

Currently hardcoded for 111 char width .MAP files, which covers the vast majority of DHS Phase V, VI, and VIII. To be extended in the future and perhaps add other useful options.

Examples

Run this code
mrdt_zip <- tempfile()
download.file("https://dhsprogram.com/data/model_data/dhs/zzmr61fl.zip",
              mrdt_zip, mode="wb")

map <- rdhs::read_zipdata(mrdt_zip, "\\.MAP", readLines)
dct <- rdhs:::parse_map(map)

Run the code above in your browser using DataLab