title: How to remove rows based multiple conditions
body: <p>I want to delete the row based on conditions specified in two different columns, for each group.
  in my case, I want to remove &quot;Death&quot; which occurs in the first admission, but keep &quot;Death&quot; when it occurs in the readmission, for each patient's id</p>
  <p>here is the initial data.frame :</p>
  <pre><code>ConditionI &lt;- c(&quot;2017-01-01&quot;, &quot;2018-01-01&quot;, &quot;2018-01-15&quot;, &quot;2018-01-20&quot;, &quot;2018-02-01&quot;, &quot;2018-02-1&quot;, &quot;2018-03-01&quot;, &quot;2018-04-01&quot;,&quot;2018-04-10&quot;)
  
  ConditionII &lt;- c(&quot;Death&quot;, &quot;Alive&quot;, &quot;Alive&quot;, &quot;Death&quot;, &quot;Alive&quot;, &quot;Alive&quot;, &quot;Death&quot;, &quot;Alive&quot;, &quot;Death&quot;)
  
  id &lt;- c(&quot;A&quot;,&quot;B&quot;,&quot;B&quot;,&quot;B&quot;,&quot;C&quot;,&quot;C&quot;,&quot;D&quot;,&quot;E&quot;,&quot;E&quot;)
  
  df &lt;- data.frame(id,ConditionI,ConditionII
  </code></pre>
  <p>my goal is :</p>
  <pre><code>ConditionII &lt;- c( &quot;Alive&quot;, &quot;Alive&quot;, &quot;Death&quot;, &quot;Alive&quot;, &quot;Alive&quot;, &quot;Alive&quot;, &quot;Death&quot;)
  ConditionI &lt;- c( &quot;2018-01-01&quot;, &quot;2018-01-15&quot;, &quot;2018-01-20&quot;, &quot;2018-02-01&quot;, &quot;2018-02-1&quot;, &quot;2018-04-01&quot;,&quot;2018-04-10&quot;)
  id &lt;- c(&quot;B&quot;,&quot;B&quot;,&quot;B&quot;,&quot;C&quot;,&quot;C&quot;,&quot;E&quot;,&quot;E&quot;)
  
  df &lt;- data.frame(id,ConditionI,ConditionII)
  </code></pre>
  <p>I thought this was a very basic question, but I tried several times and didn't get the answer. your help is very much appreciated.
  thanks in advance!</p>