As the others already pointed out in the comments, the raster()
function returns a (single) RasterLayer object. If you want a multilayer raster object you need to use the stack()
or brick()
function load the image into R. I.e.:
A <- stack("L8_stacked.tif")
If you then apply your extent with the crop()
function, the result should be a raster stack containing all the bands from the original image.
To learn more on the raster package, read this document.