title: After checking condition need to add a column and assign a value
body: <p>I have a data frame(final1) with few columns  </p>
  
  <pre><code>  for(i in final1$Total.Tyres)
    {
     if(final1$Total.Tyres[i] &gt;= 500){
      final1$flag_tyres[i]&lt;-1
     } else {
      final1$flag_tyres[i]&lt;-0
     }
    }
  </code></pre>
  
  <p>I need to check if tires are greater than 500 if so need to assign 1 adding  a new column flag_tyres
  when tried the above code give me below error</p>
  
  <pre><code> Error in if (final1$Total.Tyres[i] &gt;= 500) { : 
    missing value where TRUE/FALSE needed
  </code></pre>