relabel {pedtools} | R Documentation |
Get or modify pedigree labels
Description
Functions for getting or changing the ID labels of pedigree members.
Usage
relabel(
x,
new = "asPlot",
old = labels(x),
reorder = FALSE,
returnLabs = FALSE,
.alignment = NULL
)
## S3 method for class 'ped'
labels(object, ...)
## S3 method for class 'list'
labels(object, ..., unlist = TRUE)
Arguments
x |
A |
new |
The following values are valid (see Details and Examples):
|
old |
A vector of ID labels, of the same length as |
reorder |
A logical. If TRUE, |
returnLabs |
A logical. If TRUE, the new labels are returned as a named character vector. |
.alignment |
A list of alignment details for |
object |
A |
... |
Not used. |
unlist |
A logical; if TRUE (default), the output is unlisted to a single character vector. |
Details
By default, relabel(x)
relabels everyone as 1, 2, ..., in the order given
by the plot (top to bottom; left to right).
Alternatively, relabel(x, "generations")
labels the members in the top
generation I-1, I-2, ..., in the second generation II-1, II-2, ..., etc.
Value
-
labels()
returns a character vector containing the ID labels of all pedigree members. If the input is a list of ped objects, the output is a list of character vectors. -
relabel()
by default returns aped
object similar tox
, but with modified labels. IfreturnLabs
is TRUE, the new labels are returned as a named character vector
See Also
Examples
x = nuclearPed()
x
labels(x)
y = relabel(x, new = "girl", old = 3)
y
# Back to the numeric labels
z = relabel(y)
stopifnot(identical(x,z))
# Generation labels
relabel(x, "generations")