title: How to subset SpatialGrid using SpatialPolygon
body: <p>I am trying to subset the <code>SpatialGrid</code> with 1 polygon present in class <code>SpatialPolygons</code>. How can I do this?</p>
  
  <p>I tried it this way:</p>
  
  <pre><code>grd.clip &lt;- grd[!is.na(over(grd, polygon))]
  </code></pre>
  
  <p>But I get error</p>
  
  <pre><code>Error in matrix(idx, gr@cells.dim[2], gr@cells.dim[1], byrow = TRUE)[rows,  : 
    (subscript) logical subscript too long
  </code></pre>