I added a new variable (all zeros) to my old data frame. Now in this new data frame, I have to change the value from 0 to 1 for observations who meet the condition. The condition is on the other variable.
For example, I have variables x,y,z in this new data frame. z is the new variable I just added, they are all zero. If y=some number a, I want z=1. 
I try to use a simple for loop to accomplish this, but I have no idea where I did wrong.
for (i==999 in data$y) {
    {data$z==1} 
}
 
     
     
     
    