Internal ordering of pedigree members
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.)
reorderPed(x, neworder = NULL) parentsBeforeChildren(x) hasParentsBeforeChildren(x) foundersFirst(x) internalID(x, ids, errorIfUnknown = TRUE)
x |
A |
neworder |
A permutation of |
ids |
A character vector (or coercible to one) of original ID labels. |
errorIfUnknown |
A logical. If TRUE (default), the function stops with
an error if not all elements of |
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 foundersFirst() function reorders the pedigree so that all the founders
come first.
The utility internalID() converts ID labels to indices in the internal
ordering. If x is a list of pedigrees, the output is a data frame
containing both the component number and internal ID (within the component).
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, hence these are equivalent: internalID(x, ids = 3) internalID(x, ids = "3") hasParentsBeforeChildren(x) # Fix the ordering y = parentsBeforeChildren(x) internalID(y, ids = 3) # A different ordering reorderPed(x, c(2,1,3))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.