x = ped(id = 2:9,
fid = c(0,0,2,0,4,4,0,2),
mid = c(0,0,3,0,5,5,0,8),
sex = c(1,2,1,2,1,2,2,2))
spouses(x, id = 2) # 3, 8
children(x, 2) # 4, 9
siblings(x, 4) # 9 (full or half)
unrelated(x, 4) # 5, 8
father(x, 4) # 2
mother(x, 4) # 3
siblings(x, 4, half = FALSE) # none
siblings(x, 4, half = TRUE) # 9
niblings(x, 9) # 6, 7
niblings(x, 9, half = FALSE) # none
piblings(x, 6) # 9
piblings(x, 6, half = FALSE) # none
ancestors(x, 6) # 2, 3, 4, 5
ancestors(x, 6, maxGen = 2, inclusive = TRUE) # 4, 5, 6
descendants(x, 2) # 4, 6, 7, 9
descendants(x, 2, maxGen = 2, inclusive = TRUE) # 2, 4, 9
leaves(x) # 6, 7, 9
founders(x) # 2, 3, 5, 8
Run the code above in your browser using DataLab