I have this numerical variable in a data frame in R:
> head(sdbone$ncorrectas)
[1] 29 14 21 12 17 6
Then, I try to convert it to a dummy variable based on the condition that if ncorrectas > 10 it should have the value 1, otherwise 0:
I tried the following code :
> sdbone$ncorrectas < - ifelse(sdbone$ncorrectas > 10,1,0)
However, the variable doesn't change at all. So what's wrong with my code? and How Can I convert it to a dummy variable as I want to ?