Learn R Programming

paramlink (version 0.3-1)

createPedigree: Create simple 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 male/female offspring, while cousinPed and halfCousinPed create pedigrees linking two (half) cousins of a specified degree.

Usage

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

Arguments

boys
a nonnegative integer, the number of male offspring.
girls
a nonnegative integer, the number of female offspring.
degree
a non-negative integer: 0=siblings, 1=first cousins; 2=second cousins, a.s.o.

Value

Details

All individuals are created as unaffected. Use swapAff to edit this (see Examples). Use swapSex to change gender of pedigree members. The cousins created by cousinPed and halfCousinPed have zero removal. Removals are easily contructed using addOffspring or removeIndiv (see Examples).

See Also

swapAff, swapSex, removeIndiv, addOffspring

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)
x2 = swapAff(x, ids=c(1,3,4))

# 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
y2 = addOffspring(y, father=15, noffs=1)

# Half sibs:
z = halfCousinPed(0)
# Alternative construction:
z2 = nuclearPed(boys=1)
z2 = addOffspring(z2, father=1, noffs=1, sex=2)

Run the code above in your browser using DataLab