title: Creating a variable depending on conditions using existing three columns
body: <p>So each patient's outcome in the dataset are 1 if they were hospitalised; went into critical care; or died.</p>
  <p>As below:</p>
  <pre class="lang-r prettyprint-override"><code>ID       hosp       critical     death
  1        1          1            1
  2        1          NA           NA
  3        NA         1            NA
  4        NA         NA           1
  5        NA         NA           NA
  </code></pre>
  <p>I want to use this information to create an &quot;outcome&quot; variable. If they had all three, but ultimately had 1 for death, their outcome should be &quot;death&quot;. If they had been hospitalised and critical, their final outcome would be &quot;critical&quot;. If they were hospitalised but did not go into critical, their outcome will be &quot;severe&quot;. Lastly, if they were not admitted to anything, it will be &quot;mild&quot;</p>
  <pre class="lang-r prettyprint-override"><code>ID       Outcome       
  1        Death
  2        Severe
  3        Critical
  4        Death
  5        Mild
  </code></pre>