Learn R Programming

pedtools (version 0.9.0)

ped_internal: Internal ordering of pedigree members

Description

These functions give access to - and enable modifications of - the order in which the members of a pedigree are stored. (This is the order in which the members are listed when a ped object is printed to the screen.)

Usage

reorderPed(x, neworder = order(labels(x)))

parentsBeforeChildren(x)

hasParentsBeforeChildren(x)

internalID(x, ids)

Arguments

x

A ped object

neworder

A permutation of labels(x) or of vector 1:pedsize(x). By default, the sorting order of the ID labels is used.

ids

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

Details

The internal ordering is usually of little importance for end users, with one important exception: Certain pedigree-traversing algorithms require parents to precede their children. A special function, parentsBeforeChildren() is provided for this purpose. This is a wrapper of the more general reorderPed() which allows any permutation of the members.

It should be noted that ped() by default calls parentsBeforeChildren() whenever a pedigree is created, unless explicitly avoided with reorder = FALSE.

hasParentsBeforeChildren() can be used as a quick test to decide if it is necessary to call parentsBeforeChildren().

The utility internalID() converts ID labels to indices in the internal ordering.

See Also

ped()

Examples

Run this code
# NOT RUN {
x = ped(id = 3:1, fid = c(1,0,0), mid = c(2,0,0), sex = c(1,2,1), reorder = FALSE)
x

# The 'ids' argument is converted to character
internalID(x, ids = 3)
internalID(x, ids = "3")

y = parentsBeforeChildren(x)
internalID(y, ids = 3)

# A different ordering
reorderPed(x, c(2,1,3))

# }

Run the code above in your browser using DataLab