title: Removing rows from R data frame
body: <p>I have the following data frame:</p>
  
  <pre><code>&gt; str(df)
  'data.frame':   3149 obs. of  9 variables:
   $ mkod : int  5029 5035 5036 5042 5048 5050 5065 5071 5072 5075 ...
   $ mad  : Factor w/ 65 levels "Akgün Kasetçilik         ",..: 58 29 59 40 56 11 33 34 19 20 ...
   $ yad  : Factor w/ 44 levels "BAKUGAN","BARBIE",..: 1 1 1 1 1 1 1 1 1 1 ...
   $ donem: int  201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 ...
   $ sayi : int  201101 201101 201101 201101 201101 201101 201101 201101 201101 201101 ...
   $ plan : int  2 2 3 2 2 2 7 3 2 7 ...
   $ sevk : int  2 2 3 2 2 2 6 3 2 7 ...
   $ iade : int  0 0 3 1 2 2 6 2 2 3 ...
   $ satis: int  2 2 0 1 0 0 0 1 0 4 ...
  </code></pre>
  
  <p>I want to remove 21 specific rows from this data frame.</p>
  
  <pre><code>&gt; a &lt;- df[df$plan==0 &amp; df$sevk==0,]
  &gt; nrow(a)
  [1] 21
  </code></pre>
  
  <p>So when I remove those 21 rows, I will have a new data frame with 3149 - 21 = 3128 rows. I found the following solution:</p>
  
  <pre><code>&gt; b &lt;- df[df$plan!=0 | df$sevk!=0,]
  &gt; nrow(b)
  [1] 3128
  </code></pre>
  
  <p>My above solution uses a modified logical expression (<code>!=</code> instead of <code>==</code> and <code>|</code> instead of <code>&amp;</code>). Other than modifying the original logical expression, how can I obtain the new data frame without those 21 rows? I need something like that:</p>
  
  <pre><code>&gt; df[-a,] #does not work
  </code></pre>
  
  <p><strong>EDIT</strong> (especially for the downvoters, I hope they understand why I need an alternative solution): I asked for a different solution because I'm writing a long code, and there are various variable assignments (like <code>a</code>'s in my example) in various parts of my code. So, when I need to remove rows in advancing parts of my code, I don't want to go back and try to write the inverse of the logical expressions inside <code>a</code>-like expressions. That's why <code>df[-a,]</code> is more usable for me. </p>