Learn R Programming

pedtools (version 0.9.0)

getSex: Get or modify pedigree genders

Description

Functions for retrieving or changing the gender codes of specified pedigree members.

Usage

getSex(x, ids = labels(x))

swapSex(x, ids, verbose = TRUE)

Arguments

x

A ped object or a list of such.

ids

A character vector (or coercible to one) containing ID labels.

verbose

A logical: Verbose output or not.

Value

  • getSex() returns an integer vector of the same length as ids, with entries 0 (unknown), 1 (male) or 2 (female).

  • swapSex() returns a ped object similar to the input, but where the gender codes of ids (and their spouses) are swapped (1 <-> 2).

See Also

ped()

Examples

Run this code
# NOT RUN {
x = nuclearPed(1)
stopifnot(all(getSex(x) == c(1,2,1)))

swapSex(x, 3)

# }

Run the code above in your browser using DataLab