Description Usage Arguments Value Author(s) References See Also Examples
Some internal pedantics
modules require that pedigrees be
specified only by numerical values, including numerical values
for missing data, this converts them back to factors
1 | makePedigreeFactor(id, sire, dam, key)
|
id |
Numeric individual identifiers |
sire |
Numeric sire codes |
dam |
Numeric dam codes |
key |
A dataframe, as produced by |
returns the pedigree with all ids specified as factors according to key
Michael Morrissey michael.morrissey@st-andrews.ac.uk
Morrissey, M.B, and A.J. Wilson, 2009. pedantics, an R package for pedigree-based genetic simulation, and pedigree manipulation, characterisation, and viewing. Molecular Ecology Resources.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ## first we'll implement the example from makePedigreeNumeric(),
## and use makePedigreeFactor() to turn it back again:
pedigree<-as.data.frame(matrix(c(
"m1", NA, NA,
"m2", NA, NA,
"m3", NA, NA,
"d4", NA, NA,
"d5", NA, NA,
"o6", "m1", "d4",
"o7", "m1", "d4",
"o8", "m1", "d4",
"o9", "m1", "d4",
"o10", "m2", "d5",
"o11", "m2", "d5",
"o12", "m2", "d5",
"o13", "m2", "d5",
"o14", "m3", "d5",
"o15", "m3", "d5",
"o16", "m3", "d5",
"o17", "m3", "d5"),17,3,byrow=TRUE))
names(pedigree)<-c("id","dam","sire")
for(x in 1:3) pedigree[,x]<-as.factor(pedigree[,x])
## make the test pedigree numeric with NAs denoted by -1
test<-makePedigreeNumeric(id=as.character(pedigree[,1]),
dam=as.character(pedigree[,2]),
sire=as.character(pedigree[,3]),
missingVal=-1)
test$numericPedigree
test$idKey
## and turn it back again
makePedigreeFactor(id=test$numericPedigree$id,
dam=test$numericPedigree$dam,
sire=test$numericPedigree$sire,
key=test$idKey)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.