The tabular method for building a relationship matrix requires that every individual appears after both of its parents. This performs that topological sort and reports a cycle if the pedigree contains one.
Arguments
- ped
A data frame or S4Vectors::DataFrame with columns
id,sireanddam.
Examples
ped <- data.frame(id = c("c", "a", "b"),
sire = c("a", NA, NA),
dam = c("b", NA, NA))
sortPedigree(ped)
#> id sire dam
#> 2 a <NA> <NA>
#> 3 b <NA> <NA>
#> 1 c a b