p=cbind(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), AFF=c(2,1,2,1,2,1,1,2))
x=linkdat(p)
desc = descendants(x, 2)
spous = spouses(x, 2)
offs = offspring(x, 2)
stopifnot(setequal(spous, c(3,8)), setequal(offs, c(4,9)), setequal(desc, c(4,6,7,9)))
#Creating a loop and detecting it with 'pedigreeLoops'
#(note that we get two loops, one for each inbred child):
loopx = addOffspring(x, father=4, mother=9, noffs=2)
lps = pedigreeLoops(loopx)
stopifnot(lps[[1]]$top==2, setequal(sapply(lps, '[[', 'bottom'), 10:11))
#an example with uninformative individuals
data(dominant)
x = linkdat(dominant)
un = uninformative(x)
stopifnot(setequal(un, c(21,23)))
Run the code above in your browser using DataLab