Learn R Programming

pedtools (version 0.9.0)

ped_subgroups: Pedigree subgroups

Description

A collection of utility functions for identifying pedigree members with certain properties.

Usage

founders(x, internal = FALSE)

nonfounders(x, internal = FALSE)

leaves(x, internal = FALSE)

males(x, internal = FALSE)

females(x, internal = FALSE)

typedMembers(x, internal = FALSE)

untypedMembers(x, internal = FALSE)

father(x, id, internal = FALSE)

mother(x, id, internal = FALSE)

children(x, id, internal = FALSE)

offspring(x, id, internal = FALSE)

spouses(x, id, internal = FALSE)

unrelated(x, id, internal = FALSE)

parents(x, id, internal = FALSE)

grandparents(x, id, degree = 2, internal = FALSE)

siblings(x, id, half = NA, internal = FALSE)

cousins(x, id, degree = 1, removal = 0, half = NA, internal = FALSE)

nephews_nieces(x, id, removal = 1, half = NA, internal = FALSE)

ancestors(x, id, internal = FALSE)

descendants(x, id, internal = FALSE)

Arguments

x

A ped() object.

internal

A logical indicating whether 'id' refers to the internal order.

id

A single ID label (coercible to character).

degree, removal

Non-negative integers.

half

a logical or NA. If TRUE (resp FALSE), only half (resp. full) siblings/cousins/nephews/nieces are returned. If NA, both categories are included.

Value

For ancestors(x,id), a vector containing the IDs of all ancestors of the individual id. For descendants(x,id), a vector containing the IDs of all descendants (i.e. children, grandchildren, a.s.o.) of individual id.

The functions founders, nonfounders, males, females, leaves each return a vector containing the IDs of all pedigree members with the wanted property. (Recall that a founder is a member without parents in the pedigree, and that a leaf is a member without children in the pedigree.)

The functions father, mother, cousins, grandparents, nephews_nieces, children, parents, siblings, spouses, unrelated, each returns a vector containing the IDs of all pedigree members having the specified relationship with id.

Examples

Run this code
# NOT RUN {
x = ped(id = 2:9,
         fid = c(0,0,2,0,4,4,0,2),
         mid = c(0,0,3,0,5,5,0,8),
         sex = c(1,2,1,2,1,2,2,2))
stopifnot(setequal(spouses(x, 2), c(3,8)),
          setequal(children(x, 2), c(4,9)),
          setequal(descendants(x, 2), c(4,6,7,9)),
          setequal(leaves(x), c(6,7,9)))

# }

Run the code above in your browser using DataLab