- I loaded my dataset (original.csv) to R: original <- read.csv("original.csv")
- str(original) showed that my dataset has 16 variables (14 factors, 2 integers). 14 variables have missing values. It was OK, but 3 variables that are originally numbers, are known as factors.
- I searched web and get a command as: as.numeric(as.character(original$Tumor_Size)) (Tumor_Size is a variable that has been known as factor).
- By the way, missing values in my dataset are marked as dot (.)
- After running: as.numeric(as.character(original$Tumor_Size)), the values of Tumor_Size were listed and in the end a warning massage as: “NAs introduced by coercion” was appeared.
- I expected after running above command, the variable converted to numeric, but second str(original) showed that my guess was wrong and Tumor_Size and another two variables were factors. In the below is sample of my dataset: a piece of my dataset
How can I solve my problem?