Learn R Programming

genio (version 1.0.9)

sex_to_char: Convert integer sex codes to character codes

Description

This function accepts the integer sex codes accepted by plink and turns them into the character codes accepted by eigenstrat. Only upper-case characters are returned. The correspondence is:

0:

U (unknown)

1:

M (male)

2:

F (female)

Any other cases will also be mapped to U (unknown) but with a warning (0 does not generate warnings).

Usage

sex_to_char(sex)

Arguments

sex

Integer vector of sex codes

Value

The converged character vector of sex codes

See Also

sex_to_int

Eigenstrat IND format reference: https://github.com/DReichLab/EIG/tree/master/CONVERTF

Plink FAM format reference: https://www.cog-genomics.org/plink/1.9/formats#fam

Examples

Run this code
# NOT RUN {
# verify the mapping above
sex_int <- 0:2
sex_char <- c('U', 'M', 'F') # expected values
stopifnot(
  all(
    sex_to_char( sex_int ) == sex_char
  )
)

# }

Run the code above in your browser using DataLab