build_pedigree | R Documentation |
Builds a full pedigree out of observed data with sorting and recoding.
build_pedigree(x, self = x[[1]], sire = x[[2]], dam = x[[3]], data)
## S3 method for class 'pedigree'
as.data.frame(x, ...)
x |
if given, a vector of length 3 with indices or names of columns in
|
self |
index or column name in |
sire |
index or column name in |
dam |
index or column name in |
data |
a dataframe or a list to take the individual codes from |
... |
Not used |
A full pedigree requires that all the individual codes for sires or dams are present as individuals themselves, possibly with unknown parents. Therefore, for using it in a statistical model, it is necessary to complete the pedigree by introducing new individuals with unknown parents.
Furthermore, the codes must be sorted in ascending and consecutive order beginning from 1, and the offspring must follow parents. All this is checked, and the pedigree is reordered and recoded if needed.
If recoding is needed, the function issues a warning and an attribute 'map'
is attached to the pedigree, such that map[i] = j
means that code
i
was renumbered as j
. Therefore, if x
is a vector with
original codes, map[x]
gives the new codes. Conversely, match(y,
map)
back-transforms to original codes.
A well-formed 'pedigree'-class object. Possibly sorted and recoded.
as.data.frame(pedigree)
: Coerce to a data.frame. One row per individual,
the first column being the identification code, and the other two columns
are dad and mum codes respectively.
check_pedigree
# Founders are missing in the globulus dataset
data(globulus)
check_pedigree(globulus[,c('self', 'dad', 'mum')])
# build_pedigree completes the missing information
ped <- build_pedigree(c('self', 'dad', 'mum'), data = globulus)
check_pedigree(ped)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.