title: Adding number to variable in if else statement
body: <p>I'm trying to add a number to a variable in an ifelse statement but the current code adds regarding of the if statement</p>
  
  <pre><code>for (i in 1:data)[1]{
  data$new_variable[i] &lt;- if(!is.na(data$variable_1[i]==1)){
  data$variable_2[i] +15
  }else{
  data$variable_2[i]
  }
  }
  </code></pre>
  
  <p>My variable 1 has either 0 or 1 as a value (or NA) and I want to add 15 to variable_2 if variable_1 is 1. </p>