
Parse a StatCan PDF frequency data dictionary
Source:R/metadata_parsers.R
parse_pdf_freq_codebook.RdExtracts variable names, variable labels, value labels and per-code
frequencies from the data-dictionary appendix of a StatCan PUMF user guide
(GSS cycles, SGVP, PALS, SFS). Each variable appears as a
“Variable Name:/Position:” block followed by a frequency table whose
rows are <code> <label> <FREQ> <WTD>.
Value
Named list with elements variables (plus block,
position, length), codes, layout (always
NULL), freqs (name/val/freq/block) and ranges
(name/lo/hi/freq/block, for continuous variables), or NULL if no
variable blocks were found.
Details
Unlike the other metadata parsers this one also returns the frequencies,
which pumf_parse_metadata uses to validate the parse against
the actual microdata before allowing any label to be repaired from it.
Every returned table carries a block id – the index of the guide
block it came from. A guide covering several linked modules documents a
shared key once per module, so name alone is not unique; the block id
plus the position/length columns on variables are what
.pumf_pdf_select_blocks uses to pick the block belonging to the
module being parsed. Positions are used only for that disambiguation –
layout always comes from the command file.