Chapter 4 of 13All chapters
Chapter 4 of 13
Cleaning data
Most of the work, and it shapes the result.
The usual jobs
Missing values, duplicates, inconsistent formats, mixed units and impossible entries all have to be dealt with before any number means anything.
- Decide and record how missing values are handled: dropped, filled or flagged.
- A duplicate row silently doubles the weight of one observation.
Keep a record
Every cleaning decision is an analytical decision. Doing it in a script rather than by hand means it can be reviewed, repeated and corrected.