lowres | R Documentation |
lowres
is used to reduce the resolution of
maps of class SpatialPixelsDataFrame
.
lowres(x, np = 2, which.fac=NULL, ...)
x |
an object of class |
np |
a number giving the number of pixels to merge together (see below) |
which.fac |
a vector containing the indices of the columns of
|
... |
further arguments passed to or from other methods |
The function merges together squares of np * np
pixels. For
variables of type "numeric"
, the function averages the value of
the variable. For maps of type "factor"
, the function gives
the most frequent level in the square of np * np
pixels. When
several levels are equally represented in the square of np * np
pixels, the function randomly samples one of these levels.
Returns an object of class SpatialPixelsDataFrame
.
Clement Calenge clement.calenge@ofb.gouv.fr
SpatialPixelsDataFrame-class
for further
information on objects of class SpatialPixelsDataFrame
.
data(meuse.grid)
m <- SpatialPixelsDataFrame(points = meuse.grid[c("x", "y")],
data = meuse.grid)
m
m <- m[,3:6]
## The initial image
image(m,3)
## The transformed image
m2 <- lowres(m, np = 4)
image(m2, 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.