title: Extract coordinates from multiple datasets R
body: <p>I have found problems to extract raster values from multiple dataframes with coordinate of longitude and latitude using specific geographic region obtained from shapefiles. All the geographical region are in different extent and have a corresponding occurrence dataframe of coordinate data. 
  I tried using mask function from raster package:</p>
  
  <p>First - load shapefiles, raster layers, and dataframes as list</p>
  
  <pre><code>shp&lt;-list.files(pattern = "shp")
  shape&lt;-lapply(shp,readShapeSpatial,proj4string=CRS("+proj=longlat +ellps=WGS84"))
  
  rastFiles&lt;-list.files(pattern="bil") #List of bioclimatic variables 
  layers&lt;-stack(rastFiles)
  
  oco&lt;-list.files(pattern = ".csv")
  oco&lt;-lapply(oco,read.table,header=T,sep = ",")
  oco&lt;-lapply(oco,"[", c(6,5))
  y&lt;-lapply(oco, na.omit)
  </code></pre>
  
  <p>Second - manipulate shapefiles, crop raster layers and create a mask with geographical extension that I need.</p>
  
  <pre><code>p&lt;- lapply(shape, function(i) {
      i[i@data$ORIGIN==1,] #specifying the region of shapefile
      p1&lt;-SpatialPolygons(i@polygons,proj4string=i@proj4string) #transform specific region in shapefile
      nr&lt;-crop(layers,extent(p1)) #crop raster stack with polygons extent
      m&lt;-mask(nr,p1) #raster mask using poligon as model
      })
  </code></pre>
  
  <p>As result, the object "p" is a list with RasterBrick objects. For extract the cell values coordinates from each data frames, I tried</p>
  
  <pre><code>value&lt;-lapply(p,extract,y)
  </code></pre>
  
  <p>the console returns me that:</p>
  
  <pre><code>Error in round(y) : non-numeric argument to mathematical function
  </code></pre>
  
  <p>After checking the structure of "p" I found that the raster values are non available:</p>
  
  <pre><code>.. ..@ data    :Formal class '.MultipleRasterData' [package "raster"] with 14 slots
  .. .. .. ..@ values    : int [1:99660, 1:20] NA NA NA NA NA NA NA NA NA NA ...
  </code></pre>
  
  <p>However, I can extract one by one dataframe values in a rasterstack using list operators:</p>
  
  <pre><code>extract(nat[[1]],y[[1]])
  </code></pre>
  
  <p>In this way I have searched to understand why my lapply function for values don't work.</p>
  
  <p>Thank's for your help!</p>