I have a very large raster file that includes cells which have values ranging from 1 to 25. I want to create 25 separate rasters which only include the cells from the original with the same values.
I have looked into the 'raster' package for r and thought that RasterFromCells
might be my answer but it requires cell numbers and as my original raster has 171,681,006 cells providing cell numbers for each of the cells with each value would be extremely time consuming.
Is there a function in r that I can use to automate creating a new raster that includes all the cells with a value of 1?
Thanks.
Without a reproducible example this might not be what you want, but does this help?
library(raster)
logo <- raster(system.file("external/rlogo.grd", package="raster"))
logo.1 <- (logo == 1)
plot(logo.1)