title: Error in as.owin Handling shape files in the spatstat package R
body: <p>I´m trying to follow the tutorial <a href="http://cran.r-project.org/web/packages/spatstat/vignettes/shapefiles.pdf" rel="nofollow">"Handling shape files in the spatstat package" by Adrian Baddeley</a> where a shape as SpatialPolygonsDataFrame is converted to a collection of owin´s.</p>
  
  <p>The key attributes of shape are summarized below and my objective is to test whether a collection of points are within a collection of polygons.</p>
  
  <blockquote>
    <p>summary(shape)</p>
  </blockquote>
  
  <pre><code>Object of class SpatialPolygonsDataFrame
  Coordinates:
          min       max
  x -43.13679 -42.95351
  y -22.98961 -22.85380
  Is projected: FALSE 
  proj4string : [+proj=longlat +ellps=GRS80 +no_defs]
  </code></pre>
  
  <p>it has 907 polygons 
  here are the suggested transformations </p>
  
  <pre><code>cp &lt;- as(shape, "SpatialPolygons")
  cregions &lt;- slot(cp, "polygons")
  cregions &lt;- lapply(cregions, function(x) { SpatialPolygons(list(x)) })
  cwindows &lt;- lapply(cregions, as.owin)
  </code></pre>
  
  <p>but I get the error </p>
  
  <pre><code>Error in as.owin.default(X[[1L]], ...) : Can't interpret W as a window
  </code></pre>
  
  <p>Any ideas? Thanks</p>