Feature selection through caret

r

#1

Hi all…
Tried feature extraction through caret package.
The following is producing errors :

library(C50)
data(churn)

churnTrain = churnTrain[,! names(churnTrain) %in% c(“state”, “area_code”,
“account_length”) ]

Then, split 70 percent of the data into the training dataset and 30 percent of the data into the testing dataset:

set.seed(2)
ind = sample(2, nrow(churnTrain), replace = TRUE, prob=c(0.7, 0.3))
trainset = churnTrain[ind == 1,]
testset = churnTrain[ind == 2,]

intl_plan = model.matrix(~ trainset.international_plan - 1,
data=data.frame(trainset$international_plan))
colnames(intl_plan) = c(“trainset.international_planno”=“intl_no”,
“trainset.international_planyes”= “intl_yes”)

voice_plan = model.matrix(~ trainset.voice_mail_plan - 1,
data=data.frame(trainset$voice_mail_plan))
colnames(voice_plan) = c(“trainset.voice_mail_planno” =“voice_no”,
“trainset.voice_mail_planyes”=“voidce_yes”)

trainset$international_plan = NULL
trainset$voice_mail_plan = NULL

trainset = cbind(intl_plan,voice_plan, trainset)

intl_plan = model.matrix(~ testset.international_plan - 1,
data=data.frame(testset$international_plan))
colnames(intl_plan) = c(“testset.international_planno”=“intl_no”,
“testset.international_planyes”= “intl_yes”)

voice_plan = model.matrix(~ testset.voice_mail_plan - 1,
data=data.frame(testset$voice_mail_plan))
colnames(voice_plan) = c(“testset.voice_mail_planno” =“voice_no”,
“testset.voice_mail_planyes”=“voidce_yes”)

testset$international_plan = NULL
testset$voice_mail_plan = NULL
testset = cbind(intl_plan,voice_plan, testset)

library(caret)
ldaControl = rfeControl(functions = ldaFuncs, method = “cv”)

trainset$churn <- ifelse(trainset$churn==“yes”,1,0)
ldaProfile = rfe(trainset[, !names(trainset) %in% c(“churn”)],
trainset[,c(“churn”)],sizes = c(1:18), rfeControl = ldaControl)

ldaProfile

The ldaProfile object which is suppose to be created is not getting created and error and warning message is displayed.
Any modification , explanation…
Thanks in anticipation…