test1char <- data.frame(id=paste("fam", 101:111, sep=""),
sex=c("male","female")[c(1,2,1,2,1, 1,2, 2,1,2, 1)],
father=c(0,0,"fam101","fam101","fam101", 0,0,"fam106","fam106","fam106", "fam109"),
mother=c(0,0,"fam102","fam102","fam102", 0,0,"fam107","fam107","fam107", "fam112"))
test1newmom <- with(test1char, fixParents(id, father, mother, sex, missid="0"))
newped <- with(test1newmom, pedigree(id, dadid, momid, sex, missid="0"))
as.data.frame(newped)
Run the code above in your browser using DataLab