library(caret)
set.seed(1)
x <- data.frame(runif(10),runif(10))
y <- rnorm(10)
rfeModel <- rfe(x,y,rfeControl = rfeControl(functions = lmFuncs))
returns:
Error in { : task 1 failed – "undefined columns selected"
While this code:
data(BloodBrain)
x <- scale(bbbDescr[,-nearZeroVar(bbbDescr)])
x <- x[, -findCorrelation(cor(x), .8)]
x <- as.data.frame(x)
lmProfile <- rfe(x, logBBB,rfeControl = rfeControl(functions = lmFuncs))
Works fine. What am I doing wrong in the 1st example? (I get the same error in R 2.14.0 and 2.13.2)
Best Answer
You have to specify the
sizes
argument ($\leq 2$ in your example). The default value inrfe
issizes=2^(2:4)
, but you only have two features.?rfe