I have a data set that looks like this. I would like to recode the values if they do not fall into a set.
If my set = (Apple, Orange) I would like all other values to be ‘x’.
I have this column.
a
0 Apple
1 Apple
2 Pear
3 Banana
4 Apple
5 Orange
I would like to make it look like this column:
a
0 Apple
1 Apple
2 x
3 x
4 Apple
5 Orange