Vote count:
0
I have a data frame(df) where some columns ara defined as factors. I want to convert some of these factors into numeric. For example, to convert factor col1 into numeric, I use:
df$col1<-as.numeric(df$col1)
However, the values of col1 changes by applying this code. How can I convert a factor into numeric without changing the values of factor? I will be very glad for any help. Thanks a lot.
asked 58 secs ago
R-converting factors into numeric without changing values
Aucun commentaire:
Enregistrer un commentaire