Skip to content

Commit 727f3cd

Browse files
Keith GoldfeldKeith Goldfeld
authored andcommitted
Fixing tolerance for noLD error on CRAN
1 parent 9a90fc5 commit 727f3cd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

R/genCorOrdCat.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ genCorOrdCat <- function(dtName, idname = "id", adjVar = NULL, baseprobs,
8080
stop("Proability vector is empty")
8181
}
8282

83-
if (any(apply(baseprobs, 1, sum) != 1)) {
84-
stop("Probabilities are not properly specified")
83+
baseprobs <- round(baseprobs,3 )
84+
if (!isTRUE(all.equal(rep(1, nrow(baseprobs)),
85+
apply(baseprobs, 1, sum),
86+
tolerance = .Machine$double.eps^0.25))) {
87+
88+
stop("Probabilities are not properly specified: each row must sum to one")
8589
}
8690

8791
if (length(adjVar) > 1) {

0 commit comments

Comments
 (0)