I have a large number of rasters in grid format ("asc"). I created a list of files:
files <- list.files("D:/......../EnvironData", pattern='asc', full.names = TRUE)
Then I want to stack all files:
dataStack <- raster::stack(files)
Unfortunately, I get the following error:
Error in .local(.Object, ...) :
Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer", : Cannot create a RasterLayer object from this file.
All raster files have the same spatial dimension and extent.
lapplycall suggested by mdsummer into your question?