Finding the best way to prepare raster image for a function

#1
Hello all,

I'd like to ask what is the best way to prepare big raster images in R to run a function on whole images. I have 30 tiff images with the size of ncol=12648, nrow=4144. I read them in R separately. Then, I stacked all 30 raster images into one. Now the image size is ncol=12648, nrow=4144, nlayer=30. I'd like to run a function on the image in R. But due to big size of image, R is taking sooo long time. Therefore I need to find the best way to prepare this image without restricting file size. My main purpose is to run a function on whole image without separate it into small sections. Is there any way to do this except cropping? If so, please share with me.

Thank you very much