findPedigreeNumber: Determines the generation number for each id.

Description Usage Arguments Value Examples

View source: R/findPedigreeNumber.R

Description

One of Pedigree Curation functions

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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

rmsharp/nprcmanager documentation built on April 24, 2021, 3:13 p.m.