Step 3: For better output, convert the categorical values into numerical factors.
Eg. If the attribute is Gender with classes ‘male’ and ‘female’. Then this has to be replaced with factor levels male=0 and female=1, so that the attribute now will have 2 levels namely 0 and 1.