extend {GeneticsPed} | R Documentation |
extend
finds ascendants, which do not appear as
subjects in pedigree and assigns them as subjects with unknown
ascendants in extended pedigree.
extend(x, ascendant=NULL, col=NULL, top=TRUE)
x |
pedigree object |
ascendant |
character, column names of ascendant(s), see details |
col |
character, column name(s) of attribute(s), see details |
top |
logical, add ascendants as subjects on the top or bottom of the pedigree |
Argument ascendant
can be used to define, which ascendants will
be extended. If ascendant=NULL
, which is the default, all
ascendant columns in the pedigree are used. The same approach is used
with other pedigree attributes such as sex, generation, etc. with
argument col
. Use col=NA
, if none of the pedigree
attributes should be extended.
Sex of “new” subjects is infered from attribute
ascendantSex
as used in Pedigree
function. Generation of
“new” subjects is infered as minimal
(generationOrder="increasing"
) or maximal
(generationOrder="decreasing"
) generation value in descendants -
1. See Pedigree
on this issue. Family values are extended
with means of family
.
Extended pedigree, where all ascendants also appear as subjects with unknown ascendants and infered other attributes such as sex, generation, etc. if this attributes are in the pedigree.
Gregor Gorjanc
Pedigree
, family
,
geneticGroups???
# --- Toy example --- ped <- generatePedigree(nId=5, nGeneration=4, nFather=1, nMother=2) ped <- ped[10:20,] ped[5, "father"] <- NA # to test robustnes of extend on NA extend(ped) extend(ped, top=FALSE) ## Extend only ascendant and their generation extend(ped, col="generation") extend(ped, col=c("generation", "sex")) # --- Bigger example --- ped <- generatePedigree(nId=1000, nGeneration=10, nFather=100, nMother=500) nrow(ped) # Now keep some random individuals ped <- ped[unique(sort(round(runif(n=nrow(ped)/2, min=1, max=nrow(ped))))), ] nrow(ped) nrow(extend(ped))