Skip to content

Instantly share code, notes, and snippets.

@mdsumner
Last active May 28, 2017 03:59
Show Gist options
  • Save mdsumner/7cb21ce030ca5e9acae7d14e0d929162 to your computer and use it in GitHub Desktop.
Save mdsumner/7cb21ce030ca5e9acae7d14e0d929162 to your computer and use it in GitHub Desktop.
library(raster)
r <- raster(matrix(rnorm(5e7), 5e3))
pryr::object_size(r)
print(r)
## decide if the above is easily dealt with in memory by your system
## and compare the result without setting this option (it creates a temp file for the crop)
## sure to set with rater's interface, not like: #options(rasterMaxMemory = 1e9)
rasterOptions(maxmemory = 1e9)
crop(r, extent(0, .5, 0, 0.5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment