check {GeneticsPed} | R Documentation |
check
performs a series of checks on
pedigree object to ensure consistency of data.
check(x, ...) checkId(x)
x |
pedigree, object to be checked |
... |
arguments to other methods, none for now |
checkId
performs various checks on subjects and
their ascendants. These checks are:
checkAttributes
is intended primarly for internal use and
performs a series of checks on attribute values needed in various
functions. It causes stop with error messages for all given attribute
checks.
List of more or less self-explanatory errors and "pointers" to these errors for ease of further work i.e. removing errors.
Gregor Gorjanc
## EXAMPLES BELLOW ARE ONLY FOR TESTING PURPOSES AND ARE NOT INTENDED ## FOR USERS, BUT IT CAN NOT DO ANY HARM. ## --- checkAttributes --- tmp <- generatePedigree(5) attr(tmp, "sorted") <- FALSE attr(tmp, "coded") <- FALSE GeneticsPed:::checkAttributes(tmp) try(GeneticsPed:::checkAttributes(tmp, sorted=TRUE, coded=TRUE)) ## --- idClass --- tmp <- generatePedigree(5) tmp$id <- factor(tmp$id) class(tmp$id) class(tmp$father) try(GeneticsPed:::idClass(tmp)) ## --- subjectIsNA --- tmp <- generatePedigree(2) tmp[1, 1] <- NA GeneticsPed:::subjectIsNA(tmp) ## --- subjectNotUnique --- tmp <- generatePedigree(2) tmp[2, 1] <- 1 GeneticsPed:::subjectNotUnique(tmp) ## --- subjectEqualAscendant --- tmp <- generatePedigree(2) tmp[3, 2] <- tmp[3, 1] GeneticsPed:::subjectEqualAscendant(tmp) ## --- ascendantEqualAscendant --- tmp <- generatePedigree(2) tmp[3, 2] <- tmp[3, 3] GeneticsPed:::ascendantEqualAscendant(tmp) ## --- ascendantInAscendant --- tmp <- generatePedigree(2) tmp[3, 2] <- tmp[5, 3] GeneticsPed:::ascendantInAscendant(tmp) ## Example with multiple parents tmp <- data.frame(id=c("A", "B", "C", "D"), father1=c("E", NA, "F", "H"), father2=c("F", "E", "E", "I"), mother=c("G", NA, "H", "E")) tmp <- Pedigree(tmp, ascendant=c("father1", "father2", "mother"), ascendantSex=c(1, 1, 2), ascendantLevel=c(1, 1, 1)) GeneticsPed:::ascendantInAscendant(tmp) ## --- unusedLevels --- tmp <- generatePedigree(2, colClass="factor") tmp[3:4, 2] <- NA GeneticsPed:::unusedLevels(tmp)