Learn R Programming

paramlink (version 0.2-1)

nuclearPed: Create nuclear families or n-degree cousin pedigrees

Description

These are utility functions for creating rudimentary 'linkdat' objects with common pedigree structures. The function nuclearPed creates a nuclear family with a specified number of boy/girl offspring, while cousinPed creates a pedigree linking two cousins of specified degree.

Usage

nuclearPed(boys, girls = 0)
cousinPed(degree=1)

Arguments

boys
a nonnegative integer, the number of male offspring.
girls
a nonnegative integer, the number of female offspring.
degree
an positive integer: 1=first cousins; 2=second cousins, a.s.o.

Value

Details

All individuals are created as unaffected. Use link{modifyPedigree} to edit this (see Examples). The function cousinPed creates pedigrees linking two male cousins with zero removal. Removals are easily contructed using link{addChild} or link{removeIndiv} (see Examples).

See Also

link{modifyPedigree}, link{removeIndiv}, link{plot.pedigree}

Examples

Run this code
# A nuclear family with 2 boys and 3 girls, 
# where the father and the two boys are affected.
x=nuclearPed(boys=2, girls=3)
x=modifyPedigree(x, id=c(1,3,4), attrib='AFF')
plot(x)

# A pedigree showing a pair of third cousins
y=cousinPed(3)
plot(y)

# Adding a child on one side, to create third cousins once removed. 
# The pedigree plot above helps identifying which individual 
# should have the extra child
y = addChildren(y, father=16, mother=0)
plot(y)

Run the code above in your browser using DataLab