This code returns the error Error in { : task 1 failed - "only 0's may be mixed with negative subscripts" My dataframe is 100% correct with the first variable being the response and the remaining being numeric. I got this error and I do not know what I can do to fix it.
# Create a control object for RFE
ctrl <- rfeControl(functions = rfFuncs, method = "cv", number = 5)
# Perform RFE
rfe_result <- rfe(x = train_data[, -response_col],y = as.factor(unlist(train_data[,response_col])),
sizes = c(1:ncol(train_data)-1), rfeControl = ctrl)