title: Deleting rows that are duplicated in one column based on value in another column
body: <p>A similar question was asked <a href="https://stackoverflow.com/questions/24011246/deleting-rows-that-are-duplicated-in-one-column-based-on-the-conditions-of-anoth">here</a>. However, I did not manage to adopt that solution to my particular problem, hence the separate question.</p>
  <p>An example dataset:</p>
  <pre><code>
    id group
  1  1   5
  2  1 998
  3  2   2
  4  2   3
  5  3 998
  </code></pre>
  <p>I would like to delete all rows that are duplicated in id and where group has value 998.
  In this example, only row 2 should be deleted.</p>
  <p>I tried something along those lines:</p>
  <pre><code>df1 &lt;- df %&gt;%
    subset((unique(by = &quot;id&quot;) |  group != 998))
  </code></pre>
  <p>but got</p>
  <blockquote>
  <p>Error in is.factor(x) : Argument &quot;x&quot; is missing, with no default</p>
  </blockquote>
  <p>Thank you in advance</p>