So I have this vector that I have called RF, and I have named the data frame that this vector is in RFdf. As we can see, it is a factor. However, when I try to convert it to a numeric in the following way, I lose my RF values... Why is this happening?
Asked
Active
Viewed 17 times
0
-
You need to convert to character first: `as.numeric(as.character(RFdf$RF))` – Dave2e Oct 08 '22 at 15:46
-
This is documented in `?factor`, which recommends using `as.numeric(levels(f))[f]` to convert factor `f` to the values. – user2554330 Oct 08 '22 at 15:51