Learn R Programming

nprcgenekeepr (version 2.0.0)

convertSexCodes: Convert a sex indicator to a standardized code

Description

Part of Pedigree Curation

Usage

convertSexCodes(sex, ignoreHerm = TRUE)

Value

A vector of factors representing standardized sex codes after transformation from non-standard codes.

Arguments

sex

factor with levels: "M", "F", "U". Sex specifier for an individual.

ignoreHerm

logical flag indicating if hermaphrodites should be treated as unknown sex ("U"), default is TRUE.

Details

Standard sex codes are

  • F -- replacing "FEMALE" or "2"

  • M -- replacing "MALE" or "1"

  • H -- replacing "HERMAPHRODITE" or "4", if ignoreHerm == FALSE

  • U -- replacing "HERMAPHRODITE" or "4", if ignoreHerm == TRUE

  • U -- replacing "UNKNOWN" or "3"

Examples

Run this code
library(nprcgenekeepr)
original <- c(
  "m", "male", "1", "MALE", "M", "F", "f", "female",
  "FemAle", "U", "Unknown", "H", "hermaphrodite",
  "U", "Unknown", "3", "4"
)
sexCodes <- convertSexCodes(original)
sexCodes

Run the code above in your browser using DataLab