I have a list of 34 RasterLayers like this:
[[34]]
class      : RasterLayer 
band       : 1  (of  10  bands)
dimensions : 6899, 9663, 66665037  (nrow, ncol, ncell)
resolution : 0.0002694946, 0.0002694946  (x, y)
extent     : -6.685352, -4.081226, 39.39795, 41.2572  (xmin, xmax, ymin, ymax)
crs        : +proj=longlat +datum=WGS84 +no_defs 
source     : D:/TFM/Imagenes/Imagenes_sinClip/2017.tif 
names      : X2017 
I want to crop all the RasterLayers of the list using a simple feature like this:
> aoi
Simple feature collection with 1 feature and 2 fields
Geometry type: POLYGON
Dimension:     XY
Bounding box:  xmin: -6.571744 ymin: 39.44875 xmax: -4.10362 ymax: 41.22031
Geodetic CRS:  WGS 84
  Id     area                       geometry
1  0 29488.98 POLYGON ((-6.122013 41.2203...
To do that, I used lapply:
crop <- lapply(x = myrasterList, y = aoi, FUN = crop(x, y))
But I get the following error:
Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'crop': objeto 'x' no encontrado
 
     
    