title: R: How can I delete rows if an element in a row satisfies certain characteristic?
body: <p>I am trying to figure out a way to delete rows of matrix if a cell in that row satisfies a certain characteristic. For example:</p>
  
  <pre><code>&gt; mm &lt;- matrix(c(1,2,3,2,3,4,1,2,3,4),5,2)
  &gt; mm
       [,1] [,2]
  [1,]    1    4
  [2,]    2    1
  [3,]    3    2
  [4,]    2    3
  [5,]    3    4
  </code></pre>
  
  <p>I want to delete rows if the 1st column element in that row is 2. At the end I want this:</p>
  
  <pre><code>   [,1] [,2]
  [1,]    1    4
  [2,]    3    2
  [3,]    3    4
  </code></pre>
  
  <p>How could I do this?</p>
  
  <p>And what about a more general method if instead of deleting all rows who's first column element is 2, I needed to delete rows who's first column element corresponds to a set of numbers that are contained in a list? For example</p>
  
  <pre><code>delete_list &lt;- c(2,3)
  </code></pre>
  
  <p>What is the best way to do this?</p>
  
  <p>Thank You in advance.</p>