r - Error while using woe procedure in klaR package -
i have noticed reason procedure woe klar package produce error while trying execute on data.frame 1 column being one-level factor. here example:
a<-factor(rep(c("bad", "good"), 5)) b<-factor(rep(c(1,2), 5)) c<-factor(rep(c(2,3), 5)) d<-factor(rep(1,10)) df<-data.frame(a=a, b=b, c=c, d=d)
now execution of
woe(a~., data = df[,-4])
won't produce errors, whereas
woe(a~., data = df)
will crash following:
error in applywoes(object[[i]], x.fact[, which(names(x.fact) == names(object)[i])]) : factor levels not match! in addition: warning message: in is.na(e2) : is.na() applied non-(list or vector) of type 'null'
seems me problem d
has 1 level factor. nonetheless, definition of woe should give value of 0 such factor...
is error in procedure implementation or (for strange reason) deliberate behavior?
my guess not deliberate behaviour. read on git( https://github.com/cran/klar/blob/master/r/woe.r ), fonctions such "woe.default" start couple of check of common error cases. error checked. should contact directly team behind package proper answer.
Comments
Post a Comment