p=cbind(ID=1:6, FID=c(0,0,1,0,3,3), MID=c(0,0,2,0,4,4),
SEX=c(1,2,1,2,1,2), AFF=c(2,1,2,1,2,1))
x=linkdat(p, model=1)
#all descendents of the grandfather:
descendents(x,1)
#extracting the nuclear family where individual 3 is the father:
nucl=c(3, spouses(x,3), offspring(x,3))
y=subset(x, subset=nucl)
y
summary(y)
d=ped.dist.matrix(x)
d
#There should be 2 paths of length 3 from individual 1 to individual 4:
paths=getpaths(d,1,4)
stopifnot(dim(paths)==c(2,4))
Run the code above in your browser using DataLab