[R] Import multiple tif raster

Ivan Krylov |kry|ov @end|ng |rom d|@root@org
Thu Apr 18 14:38:46 CEST 2024

В Thu, 18 Apr 2024 11:08:33 +0200
SIBYLLE STÖCKLI via R-help <r-help using r-project.org> пишет:

> > #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

`allrasters` is an empty list, so it doesn't have a first item.
Therefore, allrasters[[1]] is an error. Why is this so? Probably
because list.files(...) above returned an empty vector.

Check rastlist and/or length(rastlist). Make sure that the path you're
giving to list.files (the one starting with
/NCCS_Impacts_Lot2_2022/InVEST/...) exists on your computer. Did you
mean to start it with a slash, making it an absolute path starting from
the root of the filesystem?

Best regards,

More information about the R-help mailing list