Module 05 Knowledge Check
5 questions. Pass mark 4 out of 5. Answer every question before checking the answer key below, then retry after reading the feedback.
1. Two NAs in a visits column — one a form never submitted, one a closed ward — should be treated…
- A. identically, as zero
- B. identically, by dropping both rows
- C. differently, because they mean different things
- D. identically, by filling with the mean
2. duplicated() on the whole table misses the duplicates that matter because…
- A. it is slow on large tables
- B. repeated submissions differ in a timestamp or user column
- C. it ignores character columns
- D. it only checks the first 100 rows
3. Keeping validation results as a check column rather than filtering lets you…
- A. run the script faster
- B. count and inspect the failures before deciding
- C. avoid writing rules
- D. skip the cleaning log
4. Wrapping as.numeric() in suppressWarnings() is dangerous because…
- A. it slows the conversion
- B. the warning was the only notice that data was being discarded
- C. it changes the column type
- D. it affects later warnings too
5. dmy('01/03/2026') and mdy('01/03/2026') return…
- A. the same date
- B. dates two months apart
- C. an error for one of them
- D. NA for both
---
Answer Key and Explanations
Check these only after attempting every question.
1. C — differently, because they mean different things
Filling both with zero asserts 'no visits happened' for both, and that is false for the ward whose form was never submitted.
2. B — repeated submissions differ in a timestamp or user column
A duplicate is a repeated key, not a repeated row. Count on the key instead.
3. B — count and inspect the failures before deciding
A filter removes the bad rows and the evidence together. Nobody upstream ever hears their system emits negative counts.
4. B — the warning was the only notice that data was being discarded
Unconvertible values silently become NA. Strip what you understand, convert, and flag what still fails.
5. B — dates two months apart
1 March and 3 January. The same eight characters, no error either way — which is why the format must be stated, never guessed.
Practical Check
Apply this module to your own work: complete the module activity for *Cleaning Data in R*, then write one sentence naming what your result shows and one naming what it does not.
Strong Answer Pattern
A strong answer names the task, the evidence used, the check performed, and the remaining limitation. It avoids "proved", "guaranteed", or "always" unless the evidence genuinely supports it.
