I read a .csv file where there is a Has_Cancer variable encoded as "No" and "Yes".
Using the command:
read.csv("data_04_Cancer.csv", sep = ',', header = TRUE)
the variable 'Has_Cancer' comes with the class 'chr'.
Then I transform that as a factor using:
data_to_work$Has_Cancer <- factor(data_to_work$Has_Cancer, label = c("No", "Yes"),levels = c(0,1))
So the result is ok: Has_Cancer: Factor w/2 levels "No", "Yes": NA NA NA...
I don't understand why 'NA' appears, I think the correct one would be 0,0,0,1,1,1... instead of NA.
would someone clarify please