Learn R Programming

paramlink (version 0.3-1)

modifyPedigree: Modify the pedigree of 'linkdat' objects

Description

Functions to modify the pedigree of a 'linkdat' object.

Usage

swapSex(x, ids)

swapAff(x, ids, newval=NULL)

addOffspring(x, father, mother, noffs, ids, sex=1, aff=1) 

addParents(x, id, father, mother)

removeIndiv(x, ids)

relabel(x, new.labels)

Arguments

x
a linkdat object
id, ids
the individual(s) to be modified. In addOffspring the (optional) ids argument is used to specify ID labels for the offspring to be created.
newval
a numeric, indicating affection status values for the ids individuals: 1=unaffected, 2=affected, 0=unknown. If NULL, the affection statuses are swapped 1 <-> 2, hence the main use of the newval argument is to assign 0's.
father, mother
integers indicating the IDs of parents. If missing, a new founder individual is created (whose ID will be 1+the largest ID already in the pedigree).
noffs
a single integer indicating the number of offspring to be created.
sex, aff
integer vectors indicating the gender and affection statuses of the offspring to be created (recycled if less than noffs elements).
new.labels
a numeric (of length x$nInd) containing new labels for the pedigree members.

Value

  • The modified linkdat object.

Details

When removing an individual, all descendants are also removed as well as founders remaining without offspring.

See Also

linkdat, nuclearPed, cousinPed, halfCousinPed

Examples

Run this code
data(toyped)
x = linkdat(toyped)

#to see the effect of each command, use \code{plot(x)} in between
x = addParents(x, id=2, father=5, mother=6)

x = swapSex(x, c(1,5))
x = swapSex(x, c(2,6))

x = addOffspring(x, mother=6, noffs=2, id=c(7,10))
x = removeIndiv(x, 3)
x = swapAff(x, c(4,10))
stopifnot(setequal(x$orig.ids, c(1,2,4,5,6,7,10,11)))

Run the code above in your browser using DataLab