# NOT RUN {
set.seed(2)
r <- raster::raster(ncols = 10, nrows = 10)
r[] <- round(runif(raster::ncell(r)) * 0.7)
r <- raster::clump(r)
r <- raster::ratify(r)
PlotMap(r)
r_new <- RmSmallCellChunks(r)
PlotMap(r_new)
graphics.off()
# }
Run the code above in your browser using DataLab