title: Nested Variable with ifelse()
body: <p>I would like to create two variables. The first determines whether a person is happy or not. If the person answers with 1 he/she is happy, if with 0 he/she is unhappy. For this I have already created this command in R.</p>
  <pre><code>    Happy &lt;- ifelse(data$happy == &quot;1&quot;, 1, 0)
  </code></pre>
  <p>Now I would like to find out, when the person answers with 0, if this has to do with the relationship status. I would like to create a dummy variable again, but in such a way that those who answered 1 in the first question are excluded.</p>
  <p>Does anyone know how to do this?</p>