I would like to import all multiple mosaic rasters (each mosaic is composed by 7 layers) from indicated folder into my R. Then access them as single multilayers rasters.
So I did:
# read all mosaics named "mos....img" in R
raster_data<-list.files(path=getwd(), pattern="mos.*.img$")
# read files as rasters
s <- stack(raster_data)
# check my imported rasters p.ex. raster n°8 from "s" raster stack
s[[8]]
and my raster s[[8]] contain only 1 layer, so not the whole mosaic was imported!
nlayers(s[[8]])
[[1]]
If I read each mosaic separately, it works:
# read 1 mosaic (composed by 7 bands)
mosaic1<-brick("mosaic1.img")
# extract one band
band4<-subset(mosaic1, 4)
Why "stack" tool doesn´t import whole mosaics but only one band of the mosaic and how it is possible to arrange it?