title: How to write if statements , multiple conditions to create new column in data frame
body: <p>I have the following script which is meant to compare values in 2 columns of a data frame and return / create a new column based on the findings (multiple conditions). </p>
  
  <p>The loop runs but does not return the new column with the findings. I would call the ifelse() function to account for vectorization here however am not sure how to pass multiple conditions to it ( appears to be binary in nature) </p>
  
  <pre><code>for( i in nrow(LeaseDF_Region)){
    if(LeaseDF_Region$HLD_Criteria_1 == "N" &amp;&amp; LeaseDF_Region$HLD_Criteria_2 == "N"){
  LeaseDF_Region$HLD_Criteria_3 == "N"
   }else if (LeaseDF_Region$HLD_Criteria_1 == "Y" &amp;&amp; LeaseDF_Region$HLD_Criteria_2 == "Y"){
    LeaseDF_Region$HLD_Criteria_3 == "Y"
   }else if (LeaseDF_Region$HLD_Criteria_1 == "Y" &amp;&amp; LeaseDF_Region$HLD_Criteria_2 == "N"){
    LeaseDF_Region$HLD_Criteria_3 == "Y"
  }else if(LeaseDF_Region$HLD_Criteria_1 == "N" &amp;&amp; LeaseDF_Region$HLD_Criteria_2 == "Y"){
     LeaseDF_Region$HLD_Criteria_3 == "Y"
  }
  }
  </code></pre>
  
  <p>Data is just values N and Y randomized for Col 1 and 2. So I am looking to do the following ( for each row in the DF) :  </p>
  
  <ul>
  <li>IF col 1 is an n and col 2 is an n then return n in new col 3</li>
  <li>IF col 1 is an n and col 2 is a y then return y in new col 3 </li>
  <li>IF col 1 is a y and col 2 is a n then return y in new col 3 </li>
  <li>IF col 1 is a y and col 2 is a y then return y in new col 3 </li>
  </ul>
  
  <p>Note n = no and y = yes</p>