Learn R Programming

pedtools (version 1.0.1)

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)

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

ancestors(x, id, inclusive = FALSE, internal = FALSE)

commonAncestors(x, ids, inclusive = FALSE, internal = FALSE)

descendants(x, id, inclusive = FALSE, internal = FALSE)

commonDescendants(x, ids, inclusive = FALSE, internal = FALSE)

Arguments

x

A ped() object or a list of such.

internal

A logical indicating whether id (or ids) refers to the internal order.

id, ids

A character (or coercible to such) with one or several ID labels.

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.

inclusive

A logical indicating whether an individual should be counted among his or her own ancestors/descendants

Value

The functions ancestors(x, id) and descendants(x, id) return a vector containing the IDs of all ancestors (resp. descendants) of the individual id within the pedigree x. If inclusive = TRUE, id is included in the output.

For commonAncestors(x, ids) and commonDescendants(x, ids), a vector containing the IDs of common ancestors to all of ids.

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))

spouses(x, id = 2) # 3, 8
children(x, 2)     # 4, 9
descendants(x, 2)  # 4, 6, 7, 9
siblings(x, 4)     # 9 (full or half)
unrelated(x, 4)    # 5, 8
father(x, 4)       # 2
mother(x, 4)       # 3

siblings(x, 4, half = FALSE) # none
siblings(x, 4, half = TRUE)  # 9

leaves(x)          # 6, 7, 9
founders(x)        # 2, 3, 5, 8

# }

Run the code above in your browser using DataLab