title: I am trying to create a new column that is conditional upon the contents of existing columns
body: <p>I am trying to make several new columns in my data frame that are conditional upon the contents of a few existing columns. </p>
  
  <p>In pseudo-code, the arguments basically go "If VariableA is 1 and either VariableB is 2 or VariableC is 3, then make VariableD = 1, and if it does not meet these conditions make it a zero. </p>
  
  <p>I have tried using for loops and ifelse statements, but have had no luck. I know that the logic of my commands are correct, but I am making some error translating it into R syntax, which isn't surprising because I just started using R about a week ago. </p>
  
  <p>Below is a simplified version of what I have tried doing...</p>
  
  <p>Data$VariableD &lt;- ifelse(Data$VariableA == 'Jim' &amp;&amp; (Data$VariableB == 2 || Data$VariableC == 3), 1, 0)</p>
  
  <p>It runs without error, but upon examining the contents of VariableD, all cells are filled with "NA"</p>
  
  <p>Here is an example using a similar dataset, notice row 1 meets the criteria. (I can't make a proper table to save my life, but I think it's interpretable.</p>
  
  <h2> |Variable A|Variable B|Variable C|Variable D|</h2>
  
  <h2>|1|    Jim   |     2    |     4    |    NA    |</h2>
  
  <h2>|2|    Tom   |     2    |     3    |    NA    |</h2>
  
  <p>|3|    Tom   |     3    |     4    |    NA    |</p>