Skip to content

Commit e80cfe9

Browse files
committed
Add try around lda normaltest
1 parent 2a9110d commit e80cfe9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

R/mlClassificationLda.R

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,13 @@ mlClassificationLda <- function(jaspResults, dataset, options, ...) {
509509
if (!ready) {
510510
return()
511511
}
512-
result <- mvnormalTest::mardia(dataset[, options[["predictors"]]])
512+
p <- try({
513+
result <- mvnormalTest::mardia(dataset[, options[["predictors"]]])
514+
})
515+
if (isTryError(p)) { # Fail gracefully
516+
table$setError(gettextf("An error occurred when creating this table: %s", jaspBase:::.extractErrorMessage(p)))
517+
return()
518+
}
513519
table[["statistic"]] <- as.numeric(as.character(result[["mv.test"]][1:2, "Statistic"]))
514520
table[["p"]] <- as.numeric(as.character(result[["mv.test"]][1:2, "p-value"]))
515521
}

0 commit comments

Comments
 (0)