Dear community

My aim is to import multiple .tif raster files using the help here:
https://stackoverflow.com/questions/52746936/how-to-efficiently-import-multi
ple-raster-tif-files-into-r

Does anyone now about the error "subscripts out of bounds"?
I am not sure about the check with alllrasters: is list() ok or should there
be a number (the number of imported .tif files?

Kind regards
Sibylle


> library(terra)
> library(raster)
> getwd()
[1] "C:/Users/Sibylle Stöckli/Desktop"
> 
> #first import all files in a single folder as a list 
> rastlist <- list.files(path =
"/NCCS_Impacts_Lot2_2022/InVEST/Species_Input/bee_presence",
pattern='.tif$', all.files= T, full.names= T)
> 
> #import all raster files in folder using lapply
> allrasters <- lapply(rastlist, raster)
> 
> #to check the index numbers of all imported raster list elements
> allrasters
list()
> 
> #call single raster element
> allrasters[[1]]
Error in allrasters[[1]] : subscript out of bounds

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to