I am trying to read multiple raster files in r I used two methods:
1 allrasters1 <- lapply(rastlist, raster)
2 allrasters2 <- stack(rastlist)
in the both cases, I got the same error
I tried the following solutions:
1 update the packages
2 re-install r (latest version)
but none of them work !!
here is the full code:
library(sp)
library(raster)
library(rgdal)
rastlist <- list.files(path = "D:\\Learn\\R\\Clip\\rasters", pattern='.tif',
all.files=TRUE, full.names=FALSE)
allrasters1 <- lapply(rastlist, raster)
allrasters2 <- stack(rastlist)