Skip to content

Commit

Permalink
version 1.4-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Cl�ment Calenge authored and gaborcsardi committed Feb 21, 2006
1 parent d4e3540 commit e63f68f
Show file tree
Hide file tree
Showing 46 changed files with 2,776 additions and 2,623 deletions.
854 changes: 427 additions & 427 deletions CONTENTS

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions DESCRIPTION
@@ -1,12 +1,12 @@
Package: adehabitat
Version: 1.4
Date: 2006/02/21
Title: Analysis of habitat selection by animals
Author: Cl�ment Calenge, contributions from Mathieu Basille and St�phane Dray
Maintainer: Cl�ment Calenge <calenge@biomserv.univ-lyon1.fr>
Depends: R (>= 1.8.0), ade4
Suggests: gpclib
Description: A collection of tools for the analysis of habitat selection by animals
Encoding: latin1
License: GPL version 2 or newer
Packaged: Tue Feb 21 14:33:26 2006; Clement Calenge
Package: adehabitat
Version: 1.4-1
Date: 2006/02/21
Title: Analysis of habitat selection by animals
Author: Cl�ment Calenge, contributions from Mathieu Basille, St�phane Dray and Scott Fortmann-Roe
Maintainer: Cl�ment Calenge <calenge@biomserv.univ-lyon1.fr>
Depends: R (>= 1.8.0), ade4
Suggests: gpclib
Description: A collection of tools for the analysis of habitat selection by animals
Encoding: latin1
License: GPL version 2 or newer
Packaged: Sat Sep 23 15:32:49 2006; calenge
198 changes: 99 additions & 99 deletions INDEX
@@ -1,99 +1,99 @@
angles Compute Turning Angles - Deprecated
area2dxf Exportation of Areas
as.area Objects of Class "area"
as.kasc Working with Several Raster Maps
as.ltraj Working with Trajectories in 2D Space: the
Class ltraj
as.sahrlocs Exploratory Analysis of Habitat Selection
as.traj Working with Trajectories in 2D Space -
Deprecated
asc2im Conversion of Maps of Class 'asc' and 'im'
(Package spatstat)
ascgen Creation of Raster Maps
bighorn Radio-Tracking of Bighorn Sheeps
biv.test Bivariate Test
buffer Compute Buffers
c.ltraj Combine Bursts of Relocations in Objects of
Class "ltraj"
chamois Location of Chamois Groups in the Chartreuse
Mountains
colasc Creates a Vector of Colors for a Raster Map of
Type 'factor'
compana Compositional Analysis of Habitat Use
convnum Conversion from Factor to Numeric for Raster
Map
count.points.id Number of Points in Each Pixel of a Raster Map
distfacmap Compute distances to the different levels of a
factor map
domain Estimation of the Potential Distribution of a
Species
eisera Eigenanalysis of Selection Ratios
enfa Ecological-Niche Factor Analysis
Extract.ltraj Extract or Replace Parts of an Object of Class
ltraj
gdltraj Working with Trajectories: Specify a Time
Period
getascattr Copy the Attributes of an Object of Class 'asc'
or 'kasc' to another Object
getcontour Computes the Contour Polygon of a Raster Object
getXYcoords Computes the X and Y Coordinates of the Pixels
of a Raster Map
hist.kasc Histograms of Mapped Variables
histniche Histograms of the Ecological Niche
hr.rast Rasterisation of Objects of Class 'area'
image.asc Displays a Color Image of an Object of Class
'asc'
image.sahrlocs Graphical Display of the Habitat Composition of
the Home Ranges of Animals Monitored Using
Radio-Tracking
import.asc Arcview ASCII Raster File Importation And
Exportation
join.asc Finds the Value of Mapped Variables at some
Specified Locations (Spatial Join)
kasc2df Conversion of Objects of Class kasc
kasc2spixdf Conversion of maps from/to the package "sp"
kernelUD Estimation of Kernel Home-Range
kselect K-Select Analysis: a Method to Analyse the
Habitat Selection by Animals
labcon Labelling Connected Features
lowres Reducing the Resolution of a Map
lynxjura Monitoring of Lynx
mahasuhab Habitat Suitability Mapping with Mahalanobis
Distances.
managNAkasc "Cleaning" Objects of Class 'kasc'
mcp Estimation of the Home Range Using the Minimum
Convex Polygon Estimator
mcp.rast Converts a Polygon to Raster
morphology Morphology: Erosion or Dilatation of Features
on a Raster Map
niche.test Monte-Carlo Test on Parameters of the
Ecological Niche
NNCH Nearest Neighbor Convex hull
perarea Compute Areas and Perimeters of Objects of
Class "area"
pheasant Radio-Tracking of Pheasants
plot.area Graphical Display of Objects of Class "area"
plot.ltraj Graphical Display of an Object of Class "ltraj"
plot.sahrlocs Exploratory Analysis of Habitat Selection
predict.enfa Habitat Suitability Maps Built from the ENFA
puechabon Radio-Tracking Data of Wild Boar
puechcirc Movements of wild boars tracked at Puechabon
puechdesIII Habitat Selection by the Wild Boar at Puechabon
rand.kselect Test of the Third-Order Habitat Selection
randtest.enfa Randomisation Test for the Ecological Niche
Factor Analysis
sahrlocs2kselect Preparation of K-Select Analysis
sahrlocs2niche OMI Analysis of Radio-Tracking Data
scatter.enfa Scatter Plot of the Results of the ENFA
schoener Compute Schoener's ratio
setmask Applies a Mask on Objects of Class 'asc' or
'kasc'
speed Computes the Speed Between Successive
Relocations of an Animal - Deprecated
squirrel Radio-Tracking Data of Squirrels
storemapattr Store attributes of maps of class asc and kasc
subsetmap Storing a Part of a Map
vanoise Habitat Use by Three Species of Galliformes in
the Vanoise National Parc
wi Computation of Selection Ratios for Habitat
Selection Studies.
angles Compute Turning Angles - Deprecated
area2dxf Exportation of Areas
as.area Objects of Class "area"
as.kasc Working with Several Raster Maps
as.ltraj Working with Trajectories in 2D Space: the
Class ltraj
as.sahrlocs Exploratory Analysis of Habitat Selection
as.traj Working with Trajectories in 2D Space -
Deprecated
asc2im Conversion of Maps of Class 'asc' and 'im'
(Package spatstat)
ascgen Creation of Raster Maps
bighorn Radio-Tracking of Bighorn Sheeps
biv.test Bivariate Test
buffer Compute Buffers
c.ltraj Combine Bursts of Relocations in Objects of
Class "ltraj"
chamois Location of Chamois Groups in the Chartreuse
Mountains
colasc Creates a Vector of Colors for a Raster Map of
Type 'factor'
compana Compositional Analysis of Habitat Use
convnum Conversion from Factor to Numeric for Raster
Map
count.points.id Number of Points in Each Pixel of a Raster Map
distfacmap Compute distances to the different levels of a
factor map
domain Estimation of the Potential Distribution of a
Species
eisera Eigenanalysis of Selection Ratios
enfa Ecological-Niche Factor Analysis
Extract.ltraj Extract or Replace Parts of an Object of Class
ltraj
gdltraj Working with Trajectories: Specify a Time
Period
getascattr Copy the Attributes of an Object of Class 'asc'
or 'kasc' to another Object
getcontour Computes the Contour Polygon of a Raster Object
getXYcoords Computes the X and Y Coordinates of the Pixels
of a Raster Map
hist.kasc Histograms of Mapped Variables
histniche Histograms of the Ecological Niche
hr.rast Rasterisation of Objects of Class 'area'
image.asc Displays a Color Image of an Object of Class
'asc'
image.sahrlocs Graphical Display of the Habitat Composition of
the Home Ranges of Animals Monitored Using
Radio-Tracking
import.asc Arcview ASCII Raster File Importation And
Exportation
join.asc Finds the Value of Mapped Variables at some
Specified Locations (Spatial Join)
kasc2df Conversion of Objects of Class kasc
kasc2spixdf Conversion of maps from/to the package "sp"
kernelUD Estimation of Kernel Home-Range
kselect K-Select Analysis: a Method to Analyse the
Habitat Selection by Animals
labcon Labelling Connected Features
lowres Reducing the Resolution of a Map
lynxjura Monitoring of Lynx
mahasuhab Habitat Suitability Mapping with Mahalanobis
Distances.
managNAkasc "Cleaning" Objects of Class 'kasc'
mcp Estimation of the Home Range Using the Minimum
Convex Polygon Estimator
mcp.rast Converts a Polygon to Raster
morphology Morphology: Erosion or Dilatation of Features
on a Raster Map
niche.test Monte-Carlo Test on Parameters of the
Ecological Niche
NNCH Nearest Neighbor Convex hull
perarea Compute Areas and Perimeters of Objects of
Class "area"
pheasant Radio-Tracking of Pheasants
plot.area Graphical Display of Objects of Class "area"
plot.ltraj Graphical Display of an Object of Class "ltraj"
plot.sahrlocs Exploratory Analysis of Habitat Selection
predict.enfa Habitat Suitability Maps Built from the ENFA
puechabon Radio-Tracking Data of Wild Boar
puechcirc Movements of wild boars tracked at Puechabon
puechdesIII Habitat Selection by the Wild Boar at Puechabon
rand.kselect Test of the Third-Order Habitat Selection
randtest.enfa Randomisation Test for the Ecological Niche
Factor Analysis
sahrlocs2kselect Preparation of K-Select Analysis
sahrlocs2niche OMI Analysis of Radio-Tracking Data
scatter.enfa Scatter Plot of the Results of the ENFA
schoener Compute Schoener's ratio
setmask Applies a Mask on Objects of Class 'asc' or
'kasc'
speed Computes the Speed Between Successive
Relocations of an Animal - Deprecated
squirrel Radio-Tracking Data of Squirrels
storemapattr Store attributes of maps of class asc and kasc
subsetmap Storing a Part of a Map
vanoise Habitat Use by Three Species of Galliformes in
the Vanoise National Parc
wi Computation of Selection Ratios for Habitat
Selection Studies.
136 changes: 68 additions & 68 deletions R/angles.r
@@ -1,68 +1,68 @@
"angles" <-
function (x, id = levels(x$id), burst = levels(x$burst),
date = NULL, slsp = c("remove", "missing"))
{
.Deprecated("as.ltraj")
if (!inherits(x, "traj"))
stop("x should be of class \"traj\"")
slsp <- match.arg(slsp)

prepangles <- function(x)
{
if (!inherits(x, "traj"))
stop("x should be of class \"traj\"")
li <- split(x, x$burst)
foo <- function(y) {
oo <- unlist(lapply(2:nrow(y),
function(i) (!all(y[i,c("x","y")]==y[i-1,c("x","y")]))))
oo <- c(TRUE,oo)
y <- y[oo,]
}
res <- do.call("rbind", lapply(li, foo))
return(res)
}

x <- getburst(x, burst = burst, id = id, date = date)
if (slsp=="remove")
x <- prepangles(x)
li <- split(x, x$burst)

foo <- function(x) {
xy<-as.matrix(x[,c("x","y")])
ang<-1:(nrow(xy)-2)
for (i in 2:(nrow(xy)-1)) {
na <- 0
ref1<-xy[i-1,]
xyb1<-t(t(xy)-ref1)
ang1<--atan2(xyb1[i,2],xyb1[i,1])

## calcul de la position de x2 et x3 rotaté
x2<-c(sqrt(sum(xyb1[i,]^2)), 0)
if (sum(abs(x2)) < 1e-7)
na<-1
x3b<-x3<-xyb1[i+1,]
x3b[1]= cos(ang1)*x3[1] - sin(ang1)*x3[2]
x3b[2]= sin(ang1)*x3[1] + cos(ang1)*x3[2]
x3<-x3b

## et recalcul de l'angle
x3<-x3-x2
if (sum(abs(x3)) < 1e-7)
na<-1
ang[i-1]<-atan2(x3[2],x3[1])
if (na > 0.5)
if (slsp == "missing")
ang[i - 1] <- NA
}
so<-data.frame(id=x$id[-c(1,nrow(xy))],
x=xy[-c(1,nrow(xy)),1],
y=xy[-c(1,nrow(xy)),2],
date=x$date[-c(1,nrow(xy))],
burst=x$burst[-c(1,nrow(xy))],
angles=ang)
}
lo <- do.call("rbind", lapply(li, foo))
row.names(lo) <- 1:nrow(lo)
return(lo)
}

"angles" <-
function (x, id = levels(x$id), burst = levels(x$burst),
date = NULL, slsp = c("remove", "missing"))
{
.Deprecated("as.ltraj")
if (!inherits(x, "traj"))
stop("x should be of class \"traj\"")
slsp <- match.arg(slsp)

prepangles <- function(x)
{
if (!inherits(x, "traj"))
stop("x should be of class \"traj\"")
li <- split(x, x$burst)
foo <- function(y) {
oo <- unlist(lapply(2:nrow(y),
function(i) (!all(y[i,c("x","y")]==y[i-1,c("x","y")]))))
oo <- c(TRUE,oo)
y <- y[oo,]
}
res <- do.call("rbind", lapply(li, foo))
return(res)
}

x <- getburst(x, burst = burst, id = id, date = date)
if (slsp=="remove")
x <- prepangles(x)
li <- split(x, x$burst)

foo <- function(x) {
xy<-as.matrix(x[,c("x","y")])
ang<-1:(nrow(xy)-2)
for (i in 2:(nrow(xy)-1)) {
na <- 0
ref1<-xy[i-1,]
xyb1<-t(t(xy)-ref1)
ang1<--atan2(xyb1[i,2],xyb1[i,1])

## calcul de la position de x2 et x3 rotaté
x2<-c(sqrt(sum(xyb1[i,]^2)), 0)
if (sum(abs(x2)) < 1e-7)
na<-1
x3b<-x3<-xyb1[i+1,]
x3b[1]= cos(ang1)*x3[1] - sin(ang1)*x3[2]
x3b[2]= sin(ang1)*x3[1] + cos(ang1)*x3[2]
x3<-x3b

## et recalcul de l'angle
x3<-x3-x2
if (sum(abs(x3)) < 1e-7)
na<-1
ang[i-1]<-atan2(x3[2],x3[1])
if (na > 0.5)
if (slsp == "missing")
ang[i - 1] <- NA
}
so<-data.frame(id=x$id[-c(1,nrow(xy))],
x=xy[-c(1,nrow(xy)),1],
y=xy[-c(1,nrow(xy)),2],
date=x$date[-c(1,nrow(xy))],
burst=x$burst[-c(1,nrow(xy))],
angles=ang)
}
lo <- do.call("rbind", lapply(li, foo))
row.names(lo) <- 1:nrow(lo)
return(lo)
}

0 comments on commit e63f68f

Please sign in to comment.