To subsample a raster in R, we can use the raster package. The raster package is widely used for working with raster data because of its efficient and fast processing.
First, install and load the raster package:
45 chars3 linesNext, we can load the raster file:
35 chars2 linesTo subsample the raster, we can use the resample() function. For example, if we want to reduce the resolution of the raster to half, we can use the following code:
40 chars2 linesThe res argument specifies the desired resolution of the output raster. In this case, we multiply the original resolution by 2 to reduce it to half.
We can then save the subsampled raster as follows:
54 chars2 linesThis will save the subsampled raster to the specified file location.
gistlibby LogSnag