This module edits and cleans the survey’s data. It checks coded items against the codebook’s lists in frequency tables, writes the cross-item rules the codebook states (a boat’s tonnage from its length, beam and depth; a unit’s scale from its boats), then writes the edit rules as specifications: a table of rules, each of which flags, sets a value, draws one at random with a seed, or refers the case to a person, applied with an edit log so every change can be read and run again. The worked examples are a blank that a rule can fill from another table, and a code outside its list replaced by a draw a rerun repeats.
The last section finds duplicates by key and by a stated definition (a registered boat under two units, an area in two strata), and lists what goes to a person to check by hand.
What you do
Section titled “What you do”- Frequency tables against the codebook's valid codes
- Range and cross-item consistency rules
- Rules as data: a specification table run to a failure report
- Specifications that edit: a value set, a code drawn at random, a case referred
- Duplicates by key and by a stated definition; the referral list
The module’s notebooks
Section titled “The module’s notebooks”- 30_edit_rules.pyEdit rules and duplicatesRead itCompanion · 8 exercises
The notebooks are in your course folder; here you can read them without running anything. For reference in any module: primer: from r to python and primer: survey sampling in one page and glossary.
Quizzes
- Check-inAt the end of the module. A short check on “Edit rules and duplicates”, and how ready you feel; its answers show as soon as you submit.Check-in: Edit rules and duplicates ↗
The quizzes are on BNHR Quizzes and count toward nothing. Learning on your own, a quiz opens as the self-paced one; while a training runs, it asks which training you are in.