Learn R Programming

paramlink (version 0.2-1)

linkdat.utils: linkdat utilities

Description

Utility functions for linkdat objects

Usage

spouses(x, i)

offspring(x, i)

descendents(x, i)

ped.dist.matrix(x)

getpaths(obj, i,j)

Arguments

x
a linkdat object
i, j
an integer, the ID of an individual.
obj
a matrix of pairwise path distances, or a linkdat object.

Value

  • For spouses(x,i), an integer vector contining the ID's of all pedigree members sharing offspring with i. For offspring(x,i), a vector containing the ID's of the offspring (i.e. children) of individual i. For descendents(x,i), a vector containing the ID's of all descendents (i.e. children, grandchildren, a.s.o.) of individual i. For ped.dist.matrix(x), a symmetrix integer matrix (d_ij), where d_ij is the pedigree distance (i.e., the length of the shortest pedigree path) between i and j. For example, pedigree members with the relations below would have the indicated pedigree distances: parent/offspring 1, siblings 2 parents 2 uncle/niece 3 first cousins 4 For getpaths(x,i,j), a data.frame with ped.dist.matrix(x)[i,j]+1 columns. Each row is a shortest pedigree path (endpoints included) from i to j.

See Also

subset.linkdat

Examples

Run this code
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