sex_to_int: Convert character sex codes to integer codes

Description Usage Arguments Value See Also Examples

View source: R/sex_to_int.R

Description

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:

Usage

1

Arguments

sex

Character vector of sex codes

Value

The converted numeric vector of sex codes

See Also

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

Examples

1
2
3
4
5
6
7
8
# 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
  )
)

genio documentation built on June 11, 2021, 5:12 p.m.