Code review: 02-education.R #6
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes
Current qualification studied (
educaim)educaim19(age 19, W6Saim)13 "Other level 1"is now grouped as1 = NVQ 1–3instead of−3 = Not asked at the fieldwork stage / participated / interviewed.educaim20(age 20, W7SAim)−94 "Insufficient information"is now mapped to−8 = Don't know / insufficient informationinstead of−2 = Script error / information lost.educaim25(age 25, S8 tick-box items)W8ACQUC0P "Academic qualifications studying: Don't know"is now mapped to−8 = Don't know / insufficient informationrather than4 = None of these qualifications.W8VCQUC0P "Vocational qualifications studying: None of the above"is now mapped to4 = None of these qualificationsinstead of2 = None / entry, so that "none of the listed qualifications" is not treated as a low-level qualification.Refusal (−9)overDon't know (−8)in the finaleducaim25variable, as intended.educaim32(age 32, S9)5 = Not studyingis now only assigned whenW9ECONACT2is in1–5or8–14, that is, when there is a valid code showing the respondent is doing something other than education.W9ECONACT2 == −1, respondents now stay as−1 = Item not applicable, instead of being re-coded as “Not studying” via the older ruleW9ECONACT2 != 6 & W9ECONACT2 != 7.Parents’ highest qualifications (
educma/educpa)19 "Qualification, level unspecified"is now mapped to3 = Otherinstead of−2 = Script error / information lost.educdtlma), the order for pulling information across sweeps is nowS1 → S2 → S4. This follows a simple rule: use the first positive (non-missing) code, and is in line with how father’s education is handled.Improvements
Current qualification studied (
educaim)For S8 and S9, I added lookup lists (for example,
educaim_groups_s8,educaim_groups_s9) that group the tick-box educational qualifications.I added a small helper function
has_any_tick()to derive “any tick in this group”.For S8 and S9, I amended the recode logic so that the helpers are used.
Parental education
parent_edu_detailed_labelsandparent_edu_simple_labels, and applied them viahaven::labelled(). This keeps the numeric codes and labels aligned with the documentation and makes them easier to inspect.educdtlma,educdtlpa) and the simpler 3-level variables (educma,educpa) is now more compact, and separates:All derived variables now stored as haven::labelled rather than factors, so that values/labels match the documentation.
Unresolved
Suggestions for documentation