This question already has an answer here:
- I want to convert some factor variables to numeric variables by this code:
df$col <- as.numeric(df$col)
The missing values in my dataset are not represented by a dot (i.e., "."). Instead, they are blank cells.
Therefore, the above code allocates a number (i.e., "1") to each blank cells in my dataset.
My question is how I can convert factor variables to numeric ones by replacing blanks cells to NA or changing them to ".".
Thank you so much.