Convert Factor to numeric

Hey Comm, I tried to convert factors in my dataset to numeric, aside the intended result that I got, it converted all blanks in the dataset to NA. How best do I convert factors to numeric or integer.

df[data] <- lapply(df[data], function(x) as.numeric(as.character(x)))

Please show what your data look like and what you want to get as a final result.

Converting blanks to NA seems reasonable. What result do you want in that case?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.