count.points {adehabitatMA}R Documentation

Number of Points in Each Pixel of a Raster Map

Description

count.points counts the number of points in each pixel of a raster map inheriting the class SpatialPixels.

Usage

count.points(xy, w)

Arguments

xy

an object of class SpatialPoints, or SpatialPointsDataFrame with one column. In the latter case, the column is considered as a factor giving, for each point, the membership of the point to a set.

w

an object inheriting the class SpatialPixels.

Value

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.

Author(s)

Clement Calenge clement.calenge@ofb.gouv.fr

See Also

SpatialPixelsDataFrame-class for additionnal information on objects of class SpatialPixelsDataFrame.

Examples


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



[Package adehabitatMA version 0.3.16 Index]