One of Pedigree Curation functions

findPedigreeNumber(id, sire, dam)

Arguments

id

character vector with unique identifier for an individual

sire

character vector with unique identifier for an individual's father (NA if unknown).

dam

character vector with unique identifier for an individual's mother (NA if unknown).

Value

Integer vector indicating generation numbers for each id, starting at 0 for individuals lacking IDs for both parents.

Examples

# \donttest{ library(nprcgenekeepr) library(stringi) ped <- nprcgenekeepr::lacy1989Ped ped$gen <- NULL ped$population <- NULL ped2 <- ped ped2$id <- stri_c(ped$id, "2") ped2$sire <- stri_c(ped$sire, "2") ped2$dam <- stri_c(ped$dam, "2") ped3 <- ped ped3$id <- stri_c(ped$id, "3") ped3$sire <- stri_c(ped$sire, "3") ped3$dam <- stri_c(ped$dam, "3") ped <- rbind(ped, ped2) ped <- rbind(ped, ped3) ped$pedigree <- findPedigreeNumber(ped$id, ped$sire, ped$dam) ped
#> id sire dam pedigree #> 1 A <NA> <NA> 1 #> 2 B <NA> <NA> 1 #> 3 C A B 1 #> 4 D A B 1 #> 5 E <NA> <NA> 1 #> 6 F D E 1 #> 7 G D E 1 #> 8 A2 <NA> <NA> 2 #> 9 B2 <NA> <NA> 2 #> 10 C2 A2 B2 2 #> 11 D2 A2 B2 2 #> 12 E2 <NA> <NA> 2 #> 13 F2 D2 E2 2 #> 14 G2 D2 E2 2 #> 15 A3 <NA> <NA> 3 #> 16 B3 <NA> <NA> 3 #> 17 C3 A3 B3 3 #> 18 D3 A3 B3 3 #> 19 E3 <NA> <NA> 3 #> 20 F3 D3 E3 3 #> 21 G3 D3 E3 3
# }