I just do not understand why my data frame keeps being a factor even if I try to change it to a character.
Here I have a data frame list_attribute$affrete
.
affrete
<chr>
Fruits
Apple
Grape Fruits
Lemon
Peach
Banana
Orange
Strawberry
Apple
And I applied a function to replace some values in list_attribute$affrete
to other values using another data frame renaming
, which has two columns(Name and Rename).
affrete <- plyr::mapvalues(x = unlist(list_attribute$affrete, use.names = F),
from = as.character(renaming$Name),
to = as.character(renaming$Rename))
affrete <- as.character(affrete)
list_attribute$affrete <- data.frame(affrete)
The data frame renaming
looks like this;
Name Rename
<fctr> <fctr>
Apple Manzana
Orange Naranja
Lemon Limon
Grape Uva
Peach Melocoton
Pinapple Anana
And here is list_attribute$affrete
after applying these processes above.
affrete
<fctr>
Manzana
Grape Fruits
Limon
Melocoton
Banana
Naranja
Strawberry
Manzana
Why is this column still a factor? I tried the method discussed here but none of them works. WHY? I'd appreciate for any help!