-
Notifications
You must be signed in to change notification settings - Fork 3
/
checkErrorLst.R
36 lines (35 loc) · 1.01 KB
/
checkErrorLst.R
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
#' checkErrorLst examines list for non-empty fields
#'
## Copyright(c) 2017-2020 R. Mark Sharp
## This file is part of nprcgenekeepr
#'
#' @return Returns \code{NULL} is all fields are empty
#' else the entire list is returned.
#'
#' @examples
#' \donttest{
#' errorLst <- qcStudbook(nprcgenekeepr::pedFemaleSireMaleDam,
#' reportErrors = TRUE)
#' checkErrorLst(errorLst)
#' }
#'
#' @param errorLst list with fields for each type of error detectable by
#' \code{qcStudbook}.
#' @export
checkErrorLst <- function(errorLst) {
if (is.null(errorLst))
return(FALSE)
if (length(errorLst$failedDatabaseConnection) > 0 |
length(errorLst$missingColumns) > 0 |
length(errorLst$invalidDateRows) > 0 |
length(errorLst$sireAndDam) > 0 |
length(errorLst$femaleSires) > 0 |
length(errorLst$maleDams) > 0 |
length(errorLst$duplicateIds) > 0 |
length(errorLst$fatalError) > 0 |
nrow(errorLst$suspiciousParents) > 0) {
return(TRUE)
} else {
return(FALSE)
}
}