Module 03 Activity
Scenario
A file has arrived from a system you do not control. Find out what is really in it before you use any of it.
What you build
An import script with declared types and missing markers, plus a data dictionary for the file.
Steps
- Read the file and record the types the import guessed. For any numeric column that arrived as text, find the value responsible.
- Declare the missing markers in the read itself rather than converting afterwards, then count the NAs the import produced.
- If the source is a spreadsheet, name the sheet explicitly and check the types afterwards rather than trusting the default read.
- Run all four inspections — head, glimpse, summary, count — and write one sentence about what each told you.
- Generate the mechanical half of a data dictionary, then write the meaning column yourself, naming what each column excludes.
- Save the cleaned object as RDS and export a CSV, then confirm which column types survive each round trip.
Evidence to hand in
- The guessed types and the value that caused any mis-guess.
- The read with its missing markers, and the resulting NA count.
- The four inspection outputs with a sentence each.
- The data dictionary, including the written meaning column.
- The round-trip comparison for RDS and CSV.
Review checklist
- Missing markers are declared at the read, not converted afterwards.
- The NA count after import is stated.
- All four inspections were run, not just
head(). - The dictionary's meaning column names what each column excludes.
- The consequence of the CSV round trip on factors and integers is stated.
