I have a set of data which includes the gender. But instead of "female" and "male", I have "female","f","male" and "m" 4 categories. I'm trying to replace all the "f" and "m" with "female" and "male" respectively.
What command do I use here?
The data look like this:
dt <- data.frame(...)
Gender Age
1 female 24
2 m 38
3 female 29
4 m 33
5 m 49
6 f 29
7 f 26
8 f 36
9 female 58
10 f 31
11 female 31
12 f 29
13 female 19
14 male 38
15 female 63
and I tried this code:
dt$Gender <- dt$Gender(c("female","female","male","male"))
but it says error.