creating raster stack (stk) file

I am looking to make a raster stack file using the following code block from the raster package. I have a folder which contains multiple rasters but i am not sure how i need to update this code to call all rasters and stack them.

any suggestions on how to "stack" these rasters?

file <- system.file("external/test.grd", package="raster")
s <- stack(c(file, file))
s <- stackSave(s, "mystack")
# note that filename adds an extension .stk to a stackfile  
## Not run: 
s2 <- stackOpen("mystack.stk")

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.