Learn R Programming

adehabitat (version 1.8.20)

count.points.id: 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 of class kasc or asc. count.points.id counts the number of points in each pixel of a raster map of class kasc or asc, for different sets of points (e.g. the relocations of several animals monitored using radio-tracking)

Usage

count.points(xy, w)
count.points.id(xy, id, w)

Arguments

xy

a data frame with 2 columns containing the x and y coordinates of the points.

id

a factor giving, for each point, the membership of a point to a set.

w

an object of class asc, kasc or mapattr.

Value

count.points returns an object of class asc containing the number of points in each cell of the raster map. count.points.id returns an object of class kasc, with one column per level of the factor id, containing the number of points numbered in each cell of the raster map.

See Also

kasc for additionnal information on objects of class kasc, and storemapattr for further information on objects of class mapattr.

Examples

Run this code
# NOT RUN {
data(puechabon)
kasc <- puechabon$kasc
locs <-  puechabon$locs

## Counts the number of relocations of each wild boar
## per pixel of the raster map
(nlocrast <- count.points.id(locs[,4:5], locs[,1], kasc))
image(nlocrast)

## Counts the number of all relocations
## per pixel of the raster map
(nlocrast <- count.points(locs[,c("X","Y")], kasc))
image(nlocrast)

# }

Run the code above in your browser using DataLab