sex_to_char: Convert integer sex codes to character codes

Description Usage Arguments Value See Also Examples

View source: R/sex_to_char.R

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. Cases outside the table below are mapped to U (unknown) with a warning. The correspondence is:

Usage

1

Arguments

sex

Integer vector of sex codes

Value

The converted 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

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

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