Track 14 · Practical Data Analysis · Lesson 2 of 11
Setting variable types
Check the type the software inferred for every column, recognise the classic inference errors, and set each variable to the type its meaning requires.
A dashboard proudly reports that the “average branch code” rose from 1 042 to 1 077 this quarter. Nobody asked for that number — the branch code was imported as a number, so the software happily averaged it. Types decide which summaries make sense, and software can only guess them.
A variable type says what kind of information a column holds, and therefore which summaries and charts are meaningful. Software infers types from how values look; you decide them from what values mean. A column of digits can be a quantity (spend), a count (items), an ordered rating (1–5) or a label that merely uses digits (a postcode).
Included with a Formula Quest membership
It has 8 graded exercises with feedback, hints and worked solutions. After it you will be able to:
- Distinguish quantities, counts, categories, ordinal ratings, yes/no flags, dates and identifiers
- Explain how the lab infers a type, including the 95% rule for numeric columns
- Spot and fix classic inference errors: codes as numbers, numbers as text, ratings as quantities
- Summarise each variable with statistics that suit its type