swapSex(x, ids)
swapAff(x, ids, newval=NULL)
addOffspring(x, father, mother, noffs, ids, sex=1, aff=1)
addParents(x, id, father, mother)
removeIndividuals(x, ids, verbose=TRUE)
trim(x, keep="available", return.ids=FALSE)
relabel(x, new, old)
linkdat
objectaddOffspring
the (optional) ids
argument is used to specify ID labels for the offspring to be created.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.noffs
elements).linkdat
object. If TRUE, a vector containing the IDs of "removable" individuals is returnedold
.new
. If missing, old
is set to x$orig.ids
, i.e. all members in their original order.linkdat
object.linkdat
, nuclearPed
, cousinPed
, halfCousinPed
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 = removeIndividuals(x, 3)
x = swapAff(x, c(4,10))
stopifnot(setequal(x$orig.ids, c(1,2,4,5,6,7,10,11)))
# trimming a pedigree
data(dominant)
x = linkdat(dominant)
x_affectedOnly = trim(x, keep="affected")
unavail = trim(x, keep="available", return.ids=TRUE)
nonaff = trim(x, keep="affected", return.ids=TRUE)
stopifnot(setequal(unavail, c(5, 19:23)), setequal(nonaff, c(6:7, 12:13, 19:23)))
Run the code above in your browser using DataLab