Skip to content

Commit

Permalink
Be a bit more defensive about invalid inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed May 17, 2023
1 parent d3c99c8 commit c749e5f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion R/validate.R
Expand Up @@ -102,15 +102,32 @@
.q <- c(0, .ci, 0.5, 1 - .ci, 1)
.obsIdx <- .nonmemObsIndex(.nonmemData)
.msg <- NULL
.etaData <- .rx$etaData
if (!is.null(.etaData)) {
if (dim(.etaData)[1] == 0) {
.etaData <- NULL
.rx$etaData <- NULL
}
}
.ipredData <- .rx$ipredData
if (!is.null(.ipredData)) {
if (dim(.ipredData)[1] == 0) {
.ipredData <- NULL
.rx$ipredData <- NULL
}
}
if (!is.null(.rx$etaData) && !is.null(.rx$ipredData)) {
if (length(.rx$ipredData[,1]) == length(.nonmemData[,1])) {
.ipredData <- .rx$ipredData[.obsIdx,]
} else {
.ipredData <- .rx$ipredData
}
.params <- .rx$etaData
.nt <- names(.theta)
for (.i in seq_along(.theta)) {
.params[[names(.theta)[.i]]] <- .theta[.i]
if (.nt[.i] %in% names(.params)) {
.params[[.nt[.i]]] <- .theta[.i]
}
}
.dn <- .rx$sigmaNames
for (.i in .dn) {
Expand Down

0 comments on commit c749e5f

Please sign in to comment.