Repair an ISCO variable
repair_isco.Rd
ISCO variables need have certain properties. In particular, they must contain occupations of a single digit. This means that all ocupations need to be either 4 digits, 3 digits, 2 digits or 1 digit. The ISCO variable can't have 3 digits and 2 digits at the same time.
Details
When reading datasets, it might happen that the ISCO column is read as a numeric column and occupations such as 0140
are converted to 140
. What this function does is a bit of sanity check:
Checks if the provided ISCO variable is a character vector, and if not, warns the user that numeric ISCO variables may contain lost data.
Checks that all occupations have the same number of digits and warns if not
Converts all occupations with digits less than
digits
to have the same number of digits by appending0
from the left until all have the same number of digits.
Even if you're working with 3/2/1 digits, your ISCO codes should have 4 digits. So instead of having an ISCO code 241, DIGCLASS expects 2410, which is a 3-digit code.