Skip to content

Commit

Permalink
Merge pull request #30 from rragundez/master
Browse files Browse the repository at this point in the history
Fix function checking for equal levels on factor columns in X and test
  • Loading branch information
sorhawell committed Oct 10, 2017
2 parents 1a2f296 + 66b6341 commit 428b0d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/Xtestmerger.R
Expand Up @@ -22,8 +22,8 @@ Xtestmerger = function(X,test,inbag=NULL,y=NULL) {
#return unmatched levels of test in X
FUN = function(xl,tl) tl[which(is.na(match(tl,xl)))], #test levels not in x
#for factor column, get all used levels
lapply(lapply( X[factor.ind],droplevels),levels),#xl
lapply(lapply(test[factor.ind],droplevels),levels),#tl
lapply( X[factor.ind],levels),#xl
lapply(test[factor.ind],levels),#tl
SIMPLIFY = FALSE, USE.NAMES = TRUE
)
unmatchedLevelsCount = sapply(unmatchedTestLevels,length)
Expand Down Expand Up @@ -55,4 +55,4 @@ Xtestmerger = function(X,test,inbag=NULL,y=NULL) {
},
isTrain = c(rep(T,dim(X)[1]),rep(F,dim(test)[1]))
))
}
}

0 comments on commit 428b0d3

Please sign in to comment.