count.points: Number of Points in Each Pixel of a Raster Map

Description Usage Arguments Value Author(s) See Also Examples

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
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

adehabitatMA documentation built on Jan. 14, 2020, 1:07 a.m.