5
$\begingroup$
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)

$\endgroup$
3
$\begingroup$

You have to specify the sizes argument ($\leq 2$ in your example). The default value in rfe is sizes=2^(2:4), but you only have two features.

?rfe

Arguments

  • ...
  • sizes

    a numeric vector of integers corresponding to the number of features that should be retained

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.