count.points | R Documentation |
count.points
counts the number of points in
each pixel of a raster map inheriting the class
SpatialPixels
.
count.points(xy, w)
xy |
an object of class |
w |
an object inheriting the class |
an object of class SpatialPixelsDataFrame
containing the number
of points in each cell of the raster map. If xy
is a
SpatialPointsDataFrame
with one column (a factor), the
resulting object contains one column per level of this factor.
Clement Calenge clement.calenge@ofb.gouv.fr
SpatialPixelsDataFrame-class
for additionnal
information on objects of class SpatialPixelsDataFrame
.
data(lynxjura)
# locs is the SpatialPointsDataFrame containing the
# locations of presence indices of Lynx in the Jura mountains (France)
locs <- lynxjura$locs
head(locs)
# sa is the SpatialPixelsDataFrame object containing
# maps of the study area
sa <- lynxjura$map
# Count all points
cp <- count.points(locs, sa)
cp
image(cp)
# count the points per type of lynx presence indices:
cp <- count.points(locs[,2], sa)
cp
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.