Learn R Programming

adehabitat (version 1.8.20)

as.sahrlocs: Exploratory Analysis of Habitat Selection

Description

as.sahrlocs creates objects of class sahrlocs. This class has a central place in habitat selection studies relying on radio-tracking data. Niche analysis and K-select analysis can be performed using this class of objects. This class may also be used for exploratory purposes. This class of object has three main components: an object of class kasc describing the study area, an object of class kasc describing what is available to the animals, and an object of class kasc describing the relocations of the animals (sahrlocs = Study Area - Home Range - reLOCationS). getsahrlocs converts one of the components of an object of class sahrlocs into an object of class kasc.

Usage

as.sahrlocs(mlocs, mhr, msa, descan = NULL)
getsahrlocs(x, what = c("sa", "hr", "locs"))
# S3 method for sahrlocs
print(x, …)

Arguments

mlocs

an object of class kasc returned by the function count.points.id

mhr

an object of class kasc returned by the function hr.rast, by the function buffer.ani, or by any other user-defined function

msa

an object of class kasc describing the study area

descan

an optionnal data frame with the number of rows equal to the number of monitored animals. Each column of this data frame gives any type of information on the monitored animals (e.g. sex, age, and so on)

what

a character string giving the component of the sahrlocs object to be converted. Should be either "sa" (study area), "hr" (home ranges) or "locs" (relocations)

x

an object of class sahrlocs

additionnal parameters to be passed to the generic function print

Value

Returns one object of class sahrlocs, which is a list containing the input arguments for the function as.sahrlocs. Objects of class sahrlocs have the same attributes as objects of class kasc (xll, yll, cellsize, nrow, and ncol).

getsahrlocs returns an object of class kasc (see kasc).

Details

The different maps in the input list of objects kasc should describe the same area (same attributes: same cellsize, same xll, same yll and same dimensions).

See Also

kasc for additionnal information on objects of class kasc, hr.rast and buffer.ani for the creation of the "hr" component of this object, count.points.id for the creation of the "locs" component of this object, plot.sahrlocs and image.sahrlocs for a graphical display of such objects.

Examples

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

## Computes the home ranges of the animals...
cp <- mcp(locs[,4:5], locs[,1])

## ... and converts it to raster
cprast <- hr.rast(cp, kasc)
locrast <- count.points.id(locs[,4:5], locs[,1], kasc)

## Creation of the sahrlocs object
(sahr <- as.sahrlocs(locrast, cprast, kasc))

## adds information on the monitored animals
age <- factor(tapply(locs[,2], locs[,1], mean))
sex <- factor(tapply(locs[,3], locs[,1], mean))
info <- as.data.frame(cbind(sex, age))
(sahr <- as.sahrlocs(locrast, cprast, kasc, info))


## Gets the "study area" component of the object
toto <- getsahrlocs(sahr)
image(toto)
# }

Run the code above in your browser using DataLab