Align Sex Coding
align_sex_coding.RdThis function detects how the sex variable is coded ('Male/Female', 'M/F', or '0(Male)/1(Female)') and converts them to 1/2.
Value
A list containing the detected coding system and the aligned sex vector with values 1 for male and 2 for female.
Examples
sex_vector <- c("Male", "Female", "Male")
align_sex_coding(sex_vector)
#> $coding
#> [1] "Male/Female"
#>
#> $sex
#> [1] "1" "2" "1"
#>