From babc96e5946902658698f142022613f1b39e817e Mon Sep 17 00:00:00 2001 From: Gavin Rhys Lloyd Date: Wed, 11 Dec 2019 13:46:16 +0000 Subject: [PATCH] default to zero if polyroot fails to return any roots default threshold is 0 because groups are +/- 1 --- R/PLSDA_class.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/PLSDA_class.R b/R/PLSDA_class.R index 5f4caf1..6044412 100644 --- a/R/PLSDA_class.R +++ b/R/PLSDA_class.R @@ -148,7 +148,12 @@ prob=function(x,yhat,ytrue) if (length(t)>1) { # multiple cross over points so choose the one closest to 0 - t=t[which.min(abs(t))] + t=t[which.min(abs(t),)] + } + + if (length(t)==0 ) { + # length is zero. how does this happen? default to 0. + t=0 } if (is.na(t)) {