title: Building a new variable in R which depends on the value of another variable
body: <p>I have to build a new variable (called: condition).
  My data frame contains three distance variables: distance1.1, distance1.2, distance1.3
  (depending on their condition, the test subjects always have values in only two of the three variables )</p>
  <p>If there is no value (NA) in the variable &quot;distance 1.1&quot;, the value of the new condition should be 1.</p>
  <p>If there is no value (NA) in the variable &quot;distance 1.2&quot;, the value of the new condition should be 2.</p>
  <p>If there is no value (NA) in the variable &quot;distance 1.3&quot;, the value of the new condition should be 3.</p>
  <p>Can anyone help me, how I can build this new variable in R?</p>