Description Usage Arguments Value Examples
View source: R/Utility_Functions.R
Find the most recent common ancestor of two pedigree members
1 |
ped |
A ped object |
ID1 |
The ID of the first relative |
ID2 |
The ID of the second relative |
The ID of the common ancestor
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | library(SimRVPedigree)
data(AgeSpecific_Hazards)
set.seed(5)
ex_ped <- sim_ped(hazard_rates = hazard(hazardDF = AgeSpecific_Hazards),
GRR = 10, FamID = 1,
founder_byears = c(1800, 1900),
stop_year = 2020)
plot(ex_ped)
# Find most recent common ancestor of individuals with IDs 19 and 21
find_mrca(ped = ex_ped, ID1 = 19, ID2 = 21)
# Note that someone can be their own most recent common ancestor.
# In the following example, since the individual with ID 8 is the grandmother
# of the individual with ID 21, the find_mrca function returns 8.
find_mrca(ped = ex_ped, ID1 = 8, ID2 = 21)
# For unrelated individuals, the find_mcra function returns NA
find_mrca(ped = ex_ped, ID1 = 8, ID2 = 15)
find_mrca(ped = ex_ped, ID1 = 5, ID2 = 4)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.