Skip to contents

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.

Usage

repair_isco(x, digits = 4)

Arguments

x

ISCO variable to repair

digits

The baseline digits that the function should expect. This is whether the variable is 4/3/2/1 digits.

Value

Repaired ISCO variable

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 appending 0 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.

Examples


repair_isco(c("1234", "5678", "9012"))
#> [1] "1234" "5678" "9012"

if (FALSE) { # \dontrun{
repair_isco(c("123", "5678", "012"))
} # }