as.factor() function in R Language is used to convert the passed object(usually Vector) into a Factor.
Object: Vector to be converted
 female male male female Levels: female male
 North North East West Levels: East North West
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.