sex_to_int | R Documentation |
This function accepts the character sex codes accepted by Eigenstrat and turns them into the integer codes accepted by Plink.
Matching is case insensitive.
Cases outside the table below are mapped to 0
(unknown) with a warning.
The correspondence is:
U
: 0
(unknown)
M
: 1
(male)
F
: 2
(female)
sex_to_int(sex)
sex |
Character vector of sex codes |
The converted numeric vector of sex codes
sex_to_char()
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
# verify the mapping above sex_char <- c('U', 'm', 'f') # mixed case works! sex_int <- 0:2 # expected values stopifnot( all( sex_to_int( sex_char ) == sex_int ) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.