I’ve a data set (myData) that contains numerical, factor, and categorical variables. One of the variable, let’s call it $x$ is a factor and I’m trying to convert it to numeric. I came across this post, and this is what I used
### Convert myData$x from factor to numeric
myData$x <- as.numeric(levels(myData$x))[ myData$x]
it seems it works, but I got this warning message:
Warning message:
NAs introduced by coercion
Is that something I should be worried about? And how can I fix it?