Skip to content

Commit babc96e

Browse files
committed
default to zero if polyroot fails to return any roots
default threshold is 0 because groups are +/- 1
1 parent 1cf78d0 commit babc96e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

R/PLSDA_class.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,12 @@ prob=function(x,yhat,ytrue)
148148

149149
if (length(t)>1) {
150150
# multiple cross over points so choose the one closest to 0
151-
t=t[which.min(abs(t))]
151+
t=t[which.min(abs(t),)]
152+
}
153+
154+
if (length(t)==0 ) {
155+
# length is zero. how does this happen? default to 0.
156+
t=0
152157
}
153158

154159
if (is.na(t)) {

0 commit comments

Comments
 (0)