How to do it...

Perform the following steps to select features:

  1. Transform the feature named as international_plan from the training dataset, trainset, to intl_yes and intl_no:
        > 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")  
  1. Transform the feature named as voice_mail_plan from the training dataset, trainset, to voice_yes and voice_no:
         > 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")
  1. Remove the ...

Get Machine Learning with R Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.