# NOT RUN {
library(nprcgenekeepr)
pedOne <- data.frame(id = c("s1", "d1", "s2", "d2", "o1", "o2", "o3", "o4"),
sire = c(NA, "s0", "s4", NA, "s1", "s1", "s2", "s2"),
dam = c(NA, "d0", "d4", NA, "d1", "d2", "d2", "d2"),
sex = c("F", "F", "M", "F", "F", "F", "F", "M"),
recordStatus = rep("original", 8),
stringsAsFactors = FALSE)
pedTwo <- data.frame(id = c("s1", "d1", "s2", "d2", "o1", "o2", "o3", "o4"),
sire = c(NA, "s0", "s4", NA, "s1", "s1", "s2", "s2"),
dam = c("d0", "d0", "d4", NA, "d1", "d2", "d2", "d2"),
sex = c("M", "M", "M", "F", "F", "F", "F", "M"),
recordStatus = rep("original", 8),
stringsAsFactors = FALSE)
pedOneCorrected <- pedOne
pedOneCorrected$sex <- correctParentSex(pedOne$id, pedOne$sire, pedOne$dam,
pedOne$sex, pedOne$recordStatus)
pedOne[pedOne$sex != pedOneCorrected$sex, ]
pedOneCorrected[pedOne$sex != pedOneCorrected$sex, ]
pedTwoCorrected <- pedTwo
pedTwoCorrected$sex <- correctParentSex(pedTwo$id, pedTwo$sire, pedTwo$dam,
pedTwo$sex, pedOne$recordStatus)
pedTwo[pedTwo$sex != pedTwoCorrected$sex, ]
pedTwoCorrected[pedTwo$sex != pedTwoCorrected$sex, ]
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab