How to convert the factor into integer in R

r

#1

I have created a variable of factor
x<-factor(c(“yes”,“no”,“yes”))
x
[1] yes no yes
Levels: no yes
I want to convert the variable x into integer


#2

@sid100158- you can use the unclass function to convert factor variable into integer variable according to level

Hope this helps!
Regards,
Harry