title: R: Remove rows from data frame based on values in several columns
body: <p>I have the following dataframe (df) - there are more columns, but these are the relevant columns:</p>
  
  <pre><code>ID  Cost 
  1    $100
  1    $200
  2    $50
  2    $0
  2    $40
  3    $10
  4    $100
  5    $0
  5    $50
  </code></pre>
  
  <p>I would like to subset this dataframe such that if any of the costs for a particular ID = $0, then it should remove all those rows (i.e. all the rows for that particular ID.)</p>
  
  <p>Therefore, in this example, ID 2 and 5 contain a $0, so all of ID 2 and ID 5 rows should be deleted.</p>
  
  <p>Here is the resulting df I would like:</p>
  
  <pre><code>    ID  Cost 
      1    $100
      1    $200
      3    $10
      4    $100
  </code></pre>
  
  <p>Could someone help with this? I tried some combinations of the <code>subset</code> function, but it didn't work.</p>
  
  <p>** On a similar note: I have another dataframe with "NA"s - could you help me figure out the same problem, in case it were NAs, instead of 0's.</p>
  
  <p>Thanks in advance!! </p>