In R I create a raster stack using the following code
#load rasters in a file list and store it to a variable
env_data<- list.files(path="C:/R_Data/WORK/env_stack", pattern='tif$', full.names = TRUE)
#create layer stack of predictors
env_predictors<- stack(env_data, quick=TRUE)
env_predictors
This works and I don't get an error. But when I try to extract values to my point data with
pc_values<- extract(env_predictors, pc_select)
I get the following
Error: Failure during raster IO
I created/prepared my rasters in QGIS and ArcGIS (slope, aspect, climate data,...). In ArcGIS I masked all rasters by another raster (always the same) and set this raster as snap raster in the environmental settings to get the same extent. All rasters have the same resolution of 50 meter. When I visually check this in QGIS or ArGIS it seems to be ok and all rasters are congruent.
I also excluded some of the rasters and sometimes I don't get the error.
Why do I get this error? I'm just starting to work with R
EDIT:
I could limit the error to some files (the DEM and derivatives) and recreated them. That doesn't help either.
I also got the error when I try to plot one of these rasters plot()
and when I write the raster stack on disk writeRaster()