I'm a beginner in R. In order to classify characters according to factors, I'm trying to match strings from variable X with factors of the variable Y.
Which function or code in R, to match or assign the character to factors which are listed in different variable of a data frame.
I have a data.frame with two variables
a b
1 maison fab
2 villa mar
3 studio seb
4 maison fab
5 villa art
6 maison sol
7 maison mar
8 studio fab
9 studio fab
10 villa stev
I would like to get the following result:
a b
1 villa fab
2 studio mar
3 maison seb
4 villa fab
5 maison art
6 studio Sol
7 studio mar
8 villa fab
9 villa fab
10 villa stev