From e63f68ff1a4d46c181efb526445ee0055b6472f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=E9ment=20Calenge?= Date: Tue, 21 Feb 2006 00:00:00 +0000 Subject: [PATCH] version 1.4-1 --- CONTENTS | 854 +++++++++++++++++++++---------------------- DESCRIPTION | 24 +- INDEX | 198 +++++----- R/angles.r | 136 +++---- R/as.ltraj.r | 495 +++++++++++-------------- R/as.traj.r | 2 + R/debut.r | 19 +- R/eisera.r | 154 ++++---- R/enfa.r | 2 + R/gdltraj.r | 42 +-- R/getverticeshr.r | 6 + R/kernelbb.r | 4 +- R/ltraj2sldf.r | 27 ++ R/ltraj2spdf.r | 14 + R/plot.hrsize.r | 33 +- R/plot.ltraj.r | 183 ++++++---- R/print.wiII.r | 2 +- R/rec.r | 9 + R/speed.r | 72 ++-- data/puechcirc.rda | Bin 8334 -> 9207 bytes data/squirreloc.rda | Bin 0 -> 3201 bytes man/Extract.ltraj.Rd | 96 ++--- man/angles.Rd | 190 +++++----- man/as.ltraj.Rd | 321 +++++++++------- man/as.traj.Rd | 276 +++++++------- man/buffer.Rd | 154 ++++---- man/c.ltraj.Rd | 66 ++-- man/compana.Rd | 358 +++++++++--------- man/eisera.Rd | 207 ++++++----- man/enfa.Rd | 2 +- man/gdltraj.Rd | 100 ++--- man/import.asc.Rd | 6 +- man/kasc2spixdf.Rd | 27 +- man/kernelUD.Rd | 17 +- man/mahasuhab.Rd | 22 +- man/mcp.Rd | 174 ++++----- man/plot.ltraj.Rd | 126 +++---- man/puechcirc.Rd | 50 +-- man/randtest.enfa.Rd | 5 +- man/rotxy.Rd | 5 +- man/schoener.Rd | 170 ++++----- man/speed.Rd | 124 +++---- man/squirrel.Rd | 3 +- man/squirreloc.Rd | 55 +++ man/wi.Rd | 496 ++++++++++++------------- src/tests.c | 73 ++-- 46 files changed, 2776 insertions(+), 2623 deletions(-) create mode 100755 R/ltraj2sldf.r create mode 100755 R/ltraj2spdf.r create mode 100755 R/rec.r create mode 100755 data/squirreloc.rda create mode 100755 man/squirreloc.Rd diff --git a/CONTENTS b/CONTENTS index bb99d29..a89979c 100755 --- a/CONTENTS +++ b/CONTENTS @@ -1,427 +1,427 @@ -Entry: angles -Aliases: angles -Keywords: spatial -Description: Compute Turning Angles -URL: ../../../library/habitat/html/angles.html - -Entry: area2dxf -Aliases: area2dxf -Keywords: hplot -Description: Exportation of Areas -URL: ../../../library/habitat/html/area2dxf.html - -Entry: as.area -Aliases: as.area, area -Keywords: spatial -Description: Objects of Class "area" -URL: ../../../library/habitat/html/as.area.html - -Entry: as.kasc -Aliases: as.kasc, getkasc, image.kasc, print.kasc, kasc -Keywords: hplot -Description: Working with several Raster Maps -URL: ../../../library/habitat/html/as.kasc.html - -Entry: as.ltraj -Aliases: as.ltraj, ltraj, print.ltraj, summary.ltraj, traj2ltraj, ltraj2traj -Keywords: spatial -Description: Working with Trajectories in 2D Space: the Class ltraj -URL: ../../../library/habitat/html/as.ltraj.html - -Entry: as.sahrlocs -Aliases: as.sahrlocs, getsahrlocs, print.sahrlocs -Keywords: spatial -Description: Exploratory Analysis of Habitat Selection -URL: ../../../library/habitat/html/as.sahrlocs.html - -Entry: as.traj -Aliases: as.traj, print.traj, plot.traj, summary.traj, getburst, traj2df, df2traj, area -Keywords: spatial -Description: Working with Trajectories in 2D Space -URL: ../../../library/habitat/html/as.traj.html - -Entry: asc2im -Aliases: asc2im, im2asc -Keywords: spatial -Description: Conversion of Maps of Class 'asc' and 'im' (package spatstat) -URL: ../../../library/habitat/html/asc2im.html - -Entry: ascgen -Aliases: ascgen -Keywords: spatial -Description: Creation of Raster Maps -URL: ../../../library/habitat/html/ascgen.html - -Entry: bighorn -Aliases: bighorn -Keywords: datasets -Description: Radio-Tracking of Bighorn Sheeps -URL: ../../../library/habitat/html/bighorn.html - -Entry: biv.test -Aliases: biv.test, biv.plot -Keywords: multivariate -Description: Bivariate Test -URL: ../../../library/habitat/html/biv.test.html - -Entry: buffer -Aliases: buffer, buffer.ani, buffer.line -Keywords: spatial -Description: Compute Buffers -URL: ../../../library/habitat/html/buffer.html - -Entry: c.ltraj -Aliases: c.ltraj -Keywords: spatial -Description: Combine Bursts of Relocations in Objects of Class "ltraj" -URL: ../../../library/habitat/html/c.ltraj.html - -Entry: chamois -Aliases: chamois -Keywords: dataset -Description: Location of Chamois Groups in the Chartreuse Mountains -URL: ../../../library/habitat/html/chamois.html - -Entry: colasc -Aliases: colasc -Keywords: programming -Description: Creates a Vector of Colors for a Raster Map of Type 'factor' -URL: ../../../library/habitat/html/colasc.html - -Entry: compana -Aliases: compana, print.compana -Keywords: math -Description: Compositional Analysis of Habitat Use -URL: ../../../library/habitat/html/compana.html - -Entry: convnum -Aliases: convnum -Keywords: manip -Description: Conversion from Factor to Numeric for Raster Maps -URL: ../../../library/habitat/html/convnum.html - -Entry: count.points.id -Aliases: count.points.id, count.points -Keywords: spatial -Description: Number of Points in Each Pixel of a Raster Map -URL: ../../../library/habitat/html/count.points.id.html - -Entry: distfacmap -Aliases: distfacmap -Keywords: spatial -Description: Compute distances to the different levels of a factor map -URL: ../../../library/habitat/html/distfacmap.html - -Entry: domain -Aliases: domain -Keywords: spatial -Description: Estimation of the Potential Distribution of a Species -URL: ../../../library/habitat/html/domain.html - -Entry: eisera -Aliases: eisera, print.esr, scatter.esr -Keywords: multivariate -Description: Eigenanalysis of Selection Ratios -URL: ../../../library/habitat/html/eisera.html - -Entry: Extract.ltraj -Aliases: Extract.ltraj, [.ltraj, [<-.ltraj -Keywords: spatial -Description: Extract or Replace Parts of an Object of Class ltraj -URL: ../../../library/habitat/html/Extract.ltraj.html - -Entry: enfa -Aliases: enfa, hist.enfa, print.enfa, data2enfa, print.dataenfa -Keywords: multivariate -Description: Ecological-Niche Factor Analysis -URL: ../../../library/habitat/html/enfa.html - -Entry: gdltraj -Aliases: gdltraj -Keywords: spatial -Description: Working with Trajectories: Specify a Time Period -URL: ../../../library/habitat/html/gdltraj.html - -Entry: getascattr -Aliases: getascattr -Keywords: programming -Description: Copy the Attributes of an Object of Class 'asc' or 'kasc' to Another Object -URL: ../../../library/habitat/html/getascattr.html - -Entry: getcontour -Aliases: getcontour -Keywords: programming -Description: Computes the Contour Polygon of a Raster Object -URL: ../../../library/habitat/html/getcontour.html - -Entry: getXYcoords -Aliases: getXYcoords -Keywords: programming -Description: Computes the X and Y Coordinates of the Pixels of a Raster Map -URL: ../../../library/habitat/html/getXYcoords.html - -Entry: hr.rast -Aliases: hr.rast -Keywords: spatial -Description: Rasterisation of objects of class "area" -URL: ../../../library/habitat/html/hr.rast.html - -Entry: hist.kasc -Aliases: hist.kasc -Keywords: hplot -Description: Histograms of Mapped Variables -URL: ../../../library/habitat/html/hist.kasc.html - -Entry: histniche -Aliases: histniche -Keywords: multivariate -Description: Histograms of the Ecological Niche of a Species -URL: ../../../library/habitat/html/histniche.html - -Entry: image.asc -Aliases: image.asc, contour.asc, persp.asc, plot.asc -Keywords: hplot -Description: Display a color image of an object of type "asc" -URL: ../../../library/habitat/html/image.asc.html - -Entry: image.sahrlocs -Aliases: image.sahrlocs -Keywords: spatial -Description: Graphical display of the habitat composition of - home ranges of animals monitored using radio-tracking -URL: ../../../library/habitat/html/image.sahrlocs.html - -Entry: import.asc -Aliases: import.asc, export.asc, print.asc, asc -Keywords: IO file -Description: Arcview ASCII raster file importation and exportation -URL: ../../../library/habitat/html/import.asc.html - -Entry: join.asc -Aliases: join.asc, join.kasc -Keywords: programming -Description: Find the value of mapped variables at specified locations -URL: ../../../library/habitat/html/join.asc.html - -Entry: kasc2df -Aliases: kasc2df, df2kasc -Keywords: multivariate -Description: Multivariate analyses of objects of class "kasc" -URL: ../../../library/habitat/html/df2kasc.html - -Entry: kasc2spixdf -Aliases: kasc2spixdf, asc2spixdf, spixdf2kasc, area2spol, spol2area, attpol2area, traj2spdf, traj2sldf -Keywords: hplot -Description: Conversion of maps from/to the package "sp" -URL: ../../../library/habitat/html/kasc2sgdf.html - -Entry: kernelUD -Aliases: kernelUD, print.khr, image.khr, plotLSCV, getvolumeUD, kernel.area, getverticeshr, kernelbb, plot.kver -Keywords: spatial -Description: Estimation of kernel home-range -URL: ../../../library/habitat/html/kernelUD.html - -Entry: kselect -Aliases: kselect, kplot.kselect, hist.kselect, print.kselect -Keywords: multivariate -Description: K-select analysis: Method to Analyse habitat selection by animals - in case of design III studies -URL: ../../../library/habitat/html/kselect.html - -Entry: labcon -Aliases: labcon -Keywords: spatial -Description: Labelling of Connected Features -URL: ../../../library/habitat/html/labcon.html - -Entry: lowres -Aliases: lowres, lowres.asc, lowres.kasc -Keywords: spatial -Description: Reducing the Resolution of a Map -URL: ../../../library/habitat/html/lowres.html - -Entry: lynxjura -Aliases: lynxjura -Keywords: datasets -Description: Monitoring of Lynx -URL: ../../../library/habitat/html/lynxjura.html - -Entry: mahasuhab -Aliases: mahasuhab -Keywords: spatial -Description: Habitat suitability mapping with mahalanobis distances. -URL: ../../../library/habitat/html/mahasuhab.html - -Entry: managNAkasc -Aliases: managNAkasc -Keywords: NA -Description: "Cleaning" of objects of class "kasc" -URL: ../../../library/habitat/html/managNAkasc.html - -Entry: mcp.rast -Aliases: mcp.rast -Keywords: spatial -Description: Converts a polygon to raster -URL: ../../../library/habitat/html/mcp.rast.html - -Entry: mcp -Aliases: mcp, mcp.area -Keywords: hplot -Description: Estimation of the Home range using the Minimum Convex Polygon -URL: ../../../library/habitat/html/mcp.html - -Entry: morphology -Aliases: morphology -Keywords: spatial -Description: Morphology: Erosion or Dilatation of Features on a Raster Map -URL: ../../../library/habitat/html/morphology.html - -Entry: niche.test -Aliases: niche.test -Keywords: multivariate -Description: Monte-Carlo Test on Parameters of the Ecological Niche -URL: ../../../library/habitat/html/niche.test.html - -Entry: NNCH -Aliases: NNCH, print.NNCH, NNCH.area, plot.NNCH, neighNNCH, plot.ngNNCH, getverticesNNCH, plot.NNCHver, NNCH.rast -Keywords: hplot -Description: Nearest Neighbor Convex hull -URL: ../../../library/habitat/html/NNCH.html - -Entry: pheasant -Aliases: pheasant -Keywords: dataset -Description: Radio-Tracking of Pheasants -URL: ../../../library/habitat/html/pheasant.html - -Entry: plot.ltraj -Aliases: plot.ltraj -Keywords: hplot -Description: Graphical Display of an Object of Class "ltraj" -URL: ../../../library/habitat/html/plot.ltraj.html - -Entry: plot.sahrlocs -Aliases: plot.sahrlocs, print.plotsahr -Keywords: hplot -Description: Exploratory Analysis of Habitat Selection -URL: ../../../library/habitat/html/plot.sahrlocs.html - -Entry: predict.enfa -Aliases: predict.enfa -Keywords: multivariate -Description: Habitat Suitability Maps Built from the ENFA -URL: ../../../library/habitat/html/predict.enfa.html - -Entry: puechabon -Aliases: puechabon -Keywords: datasets -Description: Radio-tracking of wild boars -URL: ../../../library/habitat/html/puechabon.html - -Entry: puechcirc -Aliases: puechcirc -Keywords: datasets -Description: -URL: ../../../library/habitat/html/puechdesIII.html - -Entry: puechdesIII -Aliases: puechdesIII -Keywords: datasets -Description: Habitat selection by the wild boar at Puechabon -URL: ../../../library/habitat/html/puechdesIII.html - -Entry: perarea -Aliases: perarea, ararea -Keywords: hplot -Description: Compute Areas and Perimeters of Objects of Class "area" -URL: ../../../library/habitat/html/perarea.html - -Entry: plot.area -Aliases: plot.area -Keywords: hplot -Description: Graphical Display of Objects of Class "area" -URL: ../../../library/habitat/html/plot.area.html - -Entry: rand.kselect -Aliases: rand.kselect, print.rand.kselect -Keywords: multivariate -Description: Test of the third order habitat selection -URL: ../../../library/habitat/html/rand.kselect.html - -Entry: randtest.enfa -Aliases: randtest.enfa -Keywords: multivariate -Description: {Randomisation Test for the Ecological Niche Factor Analysis -URL: ../../../library/habitat/html/randtest.enfa.html - -Entry: rotxy -Aliases: rotxy, .buffer.point.unic, profilehab -Keywords: internal -Description: internal functions for package habitat -URL: ../../../library/habitat/html/rotxy.html - -Entry: sahrlocs2kselect -Aliases: sahrlocs2kselect -Keywords: multivariate -Description: Preparation of a K-select analysis of radio-tracking data -URL: ../../../library/habitat/html/sahrlocs2kselect.html - -Entry: sahrlocs2niche -Aliases: sahrlocs2niche -Keywords: multivariate -Description: OMI Analysis of Radio-Tracking Data -URL: ../../../library/habitat/html/sahrlocs2niche.html - -Entry: scatter.enfa -Aliases: scatter.enfa -Keywords: multivariate -Description: Scatter Plot of the Results of the ENFA -URL: ../../../library/habitat/html/scatter.enfa.html - -Entry: schoener -Aliases: schoener, schoener.rtest -Keywords: math -Description: Compute Schoener's ratio -URL: ../../../library/habitat/html/schoener.html - -Entry: setmask -Aliases: setmask -Keywords: spatial -Description: Applies a Mask on Objects of Class "asc" or "kasc" -URL: ../../../library/habitat/html/setmask.html - -Entry: speed -Aliases: speed -Keywords: spatial -Description: Computes Speed Between Successive Relocations of an Animal -URL: ../../../library/habitat/html/speed.html - -Entry: squirrel -Aliases: squirrel -Keywords: dataset -Description: Radio-Tracking Data of Squirrels -URL: ../../../library/habitat/html/squirrel.html - -Entry: storemapattr -Aliases: storemapattr -Keywords: programming -Description: Store attributes of maps of class asc and kasc -URL: ../../../library/habitat/html/storemapattr.html - -Entry: subsetmap -Aliases: subsetmap,subsetmap.asc,subsetmap.kasc -Keywords: spatial -Description: Storing a part of a map -URL: ../../../library/habitat/html/subsetmap.html - -Entry: vanoise -Aliases: vanoise -Keywords: dataset -Description: Habitat Use by Three Species of Galliformes in the Vanoise National Parc -URL: ../../../library/habitat/html/vanoise.html - -Entry: wi -Aliases: wi, widesI, widesII, widesIII, print.wiI, print.wiII, print.wiIII, plot.wi, wiI, wiII -Keywords: hplot -Description: Computation of selection ratios for habitat selection studies -URL: ../../../library/habitat/html/wi.html +Entry: angles +Aliases: angles +Keywords: spatial +Description: Compute Turning Angles +URL: ../../../library/habitat/html/angles.html + +Entry: area2dxf +Aliases: area2dxf +Keywords: hplot +Description: Exportation of Areas +URL: ../../../library/habitat/html/area2dxf.html + +Entry: as.area +Aliases: as.area, area +Keywords: spatial +Description: Objects of Class "area" +URL: ../../../library/habitat/html/as.area.html + +Entry: as.kasc +Aliases: as.kasc, getkasc, image.kasc, print.kasc, kasc +Keywords: hplot +Description: Working with several Raster Maps +URL: ../../../library/habitat/html/as.kasc.html + +Entry: as.ltraj +Aliases: as.ltraj, ltraj, print.ltraj, summary.ltraj, traj2ltraj, ltraj2traj +Keywords: spatial +Description: Working with Trajectories in 2D Space: the Class ltraj +URL: ../../../library/habitat/html/as.ltraj.html + +Entry: as.sahrlocs +Aliases: as.sahrlocs, getsahrlocs, print.sahrlocs +Keywords: spatial +Description: Exploratory Analysis of Habitat Selection +URL: ../../../library/habitat/html/as.sahrlocs.html + +Entry: as.traj +Aliases: as.traj, print.traj, plot.traj, summary.traj, getburst, traj2df, df2traj, area +Keywords: spatial +Description: Working with Trajectories in 2D Space +URL: ../../../library/habitat/html/as.traj.html + +Entry: asc2im +Aliases: asc2im, im2asc +Keywords: spatial +Description: Conversion of Maps of Class 'asc' and 'im' (package spatstat) +URL: ../../../library/habitat/html/asc2im.html + +Entry: ascgen +Aliases: ascgen +Keywords: spatial +Description: Creation of Raster Maps +URL: ../../../library/habitat/html/ascgen.html + +Entry: bighorn +Aliases: bighorn +Keywords: datasets +Description: Radio-Tracking of Bighorn Sheeps +URL: ../../../library/habitat/html/bighorn.html + +Entry: biv.test +Aliases: biv.test, biv.plot +Keywords: multivariate +Description: Bivariate Test +URL: ../../../library/habitat/html/biv.test.html + +Entry: buffer +Aliases: buffer, buffer.ani, buffer.line +Keywords: spatial +Description: Compute Buffers +URL: ../../../library/habitat/html/buffer.html + +Entry: c.ltraj +Aliases: c.ltraj +Keywords: spatial +Description: Combine Bursts of Relocations in Objects of Class "ltraj" +URL: ../../../library/habitat/html/c.ltraj.html + +Entry: chamois +Aliases: chamois +Keywords: dataset +Description: Location of Chamois Groups in the Chartreuse Mountains +URL: ../../../library/habitat/html/chamois.html + +Entry: colasc +Aliases: colasc +Keywords: programming +Description: Creates a Vector of Colors for a Raster Map of Type 'factor' +URL: ../../../library/habitat/html/colasc.html + +Entry: compana +Aliases: compana, print.compana +Keywords: math +Description: Compositional Analysis of Habitat Use +URL: ../../../library/habitat/html/compana.html + +Entry: convnum +Aliases: convnum +Keywords: manip +Description: Conversion from Factor to Numeric for Raster Maps +URL: ../../../library/habitat/html/convnum.html + +Entry: count.points.id +Aliases: count.points.id, count.points +Keywords: spatial +Description: Number of Points in Each Pixel of a Raster Map +URL: ../../../library/habitat/html/count.points.id.html + +Entry: distfacmap +Aliases: distfacmap +Keywords: spatial +Description: Compute distances to the different levels of a factor map +URL: ../../../library/habitat/html/distfacmap.html + +Entry: domain +Aliases: domain +Keywords: spatial +Description: Estimation of the Potential Distribution of a Species +URL: ../../../library/habitat/html/domain.html + +Entry: eisera +Aliases: eisera, print.esr, scatter.esr +Keywords: multivariate +Description: Eigenanalysis of Selection Ratios +URL: ../../../library/habitat/html/eisera.html + +Entry: Extract.ltraj +Aliases: Extract.ltraj, [.ltraj, [<-.ltraj +Keywords: spatial +Description: Extract or Replace Parts of an Object of Class ltraj +URL: ../../../library/habitat/html/Extract.ltraj.html + +Entry: enfa +Aliases: enfa, hist.enfa, print.enfa, data2enfa, print.dataenfa +Keywords: multivariate +Description: Ecological-Niche Factor Analysis +URL: ../../../library/habitat/html/enfa.html + +Entry: gdltraj +Aliases: gdltraj +Keywords: spatial +Description: Working with Trajectories: Specify a Time Period +URL: ../../../library/habitat/html/gdltraj.html + +Entry: getascattr +Aliases: getascattr +Keywords: programming +Description: Copy the Attributes of an Object of Class 'asc' or 'kasc' to Another Object +URL: ../../../library/habitat/html/getascattr.html + +Entry: getcontour +Aliases: getcontour +Keywords: programming +Description: Computes the Contour Polygon of a Raster Object +URL: ../../../library/habitat/html/getcontour.html + +Entry: getXYcoords +Aliases: getXYcoords +Keywords: programming +Description: Computes the X and Y Coordinates of the Pixels of a Raster Map +URL: ../../../library/habitat/html/getXYcoords.html + +Entry: hr.rast +Aliases: hr.rast +Keywords: spatial +Description: Rasterisation of objects of class "area" +URL: ../../../library/habitat/html/hr.rast.html + +Entry: hist.kasc +Aliases: hist.kasc +Keywords: hplot +Description: Histograms of Mapped Variables +URL: ../../../library/habitat/html/hist.kasc.html + +Entry: histniche +Aliases: histniche +Keywords: multivariate +Description: Histograms of the Ecological Niche of a Species +URL: ../../../library/habitat/html/histniche.html + +Entry: image.asc +Aliases: image.asc, contour.asc, persp.asc, plot.asc +Keywords: hplot +Description: Display a color image of an object of type "asc" +URL: ../../../library/habitat/html/image.asc.html + +Entry: image.sahrlocs +Aliases: image.sahrlocs +Keywords: spatial +Description: Graphical display of the habitat composition of + home ranges of animals monitored using radio-tracking +URL: ../../../library/habitat/html/image.sahrlocs.html + +Entry: import.asc +Aliases: import.asc, export.asc, print.asc, asc +Keywords: IO file +Description: Arcview ASCII raster file importation and exportation +URL: ../../../library/habitat/html/import.asc.html + +Entry: join.asc +Aliases: join.asc, join.kasc +Keywords: programming +Description: Find the value of mapped variables at specified locations +URL: ../../../library/habitat/html/join.asc.html + +Entry: kasc2df +Aliases: kasc2df, df2kasc +Keywords: multivariate +Description: Multivariate analyses of objects of class "kasc" +URL: ../../../library/habitat/html/df2kasc.html + +Entry: kasc2spixdf +Aliases: kasc2spixdf, asc2spixdf, spixdf2kasc, area2spol, spol2area, attpol2area, traj2spdf, traj2sldf +Keywords: hplot +Description: Conversion of maps from/to the package "sp" +URL: ../../../library/habitat/html/kasc2sgdf.html + +Entry: kernelUD +Aliases: kernelUD, print.khr, image.khr, plotLSCV, getvolumeUD, kernel.area, getverticeshr, kernelbb, plot.kver +Keywords: spatial +Description: Estimation of kernel home-range +URL: ../../../library/habitat/html/kernelUD.html + +Entry: kselect +Aliases: kselect, kplot.kselect, hist.kselect, print.kselect +Keywords: multivariate +Description: K-select analysis: Method to Analyse habitat selection by animals + in case of design III studies +URL: ../../../library/habitat/html/kselect.html + +Entry: labcon +Aliases: labcon +Keywords: spatial +Description: Labelling of Connected Features +URL: ../../../library/habitat/html/labcon.html + +Entry: lowres +Aliases: lowres, lowres.asc, lowres.kasc +Keywords: spatial +Description: Reducing the Resolution of a Map +URL: ../../../library/habitat/html/lowres.html + +Entry: lynxjura +Aliases: lynxjura +Keywords: datasets +Description: Monitoring of Lynx +URL: ../../../library/habitat/html/lynxjura.html + +Entry: mahasuhab +Aliases: mahasuhab +Keywords: spatial +Description: Habitat suitability mapping with mahalanobis distances. +URL: ../../../library/habitat/html/mahasuhab.html + +Entry: managNAkasc +Aliases: managNAkasc +Keywords: NA +Description: "Cleaning" of objects of class "kasc" +URL: ../../../library/habitat/html/managNAkasc.html + +Entry: mcp.rast +Aliases: mcp.rast +Keywords: spatial +Description: Converts a polygon to raster +URL: ../../../library/habitat/html/mcp.rast.html + +Entry: mcp +Aliases: mcp, mcp.area +Keywords: hplot +Description: Estimation of the Home range using the Minimum Convex Polygon +URL: ../../../library/habitat/html/mcp.html + +Entry: morphology +Aliases: morphology +Keywords: spatial +Description: Morphology: Erosion or Dilatation of Features on a Raster Map +URL: ../../../library/habitat/html/morphology.html + +Entry: niche.test +Aliases: niche.test +Keywords: multivariate +Description: Monte-Carlo Test on Parameters of the Ecological Niche +URL: ../../../library/habitat/html/niche.test.html + +Entry: NNCH +Aliases: NNCH, print.NNCH, NNCH.area, plot.NNCH, neighNNCH, plot.ngNNCH, getverticesNNCH, plot.NNCHver, NNCH.rast +Keywords: hplot +Description: Nearest Neighbor Convex hull +URL: ../../../library/habitat/html/NNCH.html + +Entry: pheasant +Aliases: pheasant +Keywords: dataset +Description: Radio-Tracking of Pheasants +URL: ../../../library/habitat/html/pheasant.html + +Entry: plot.ltraj +Aliases: plot.ltraj +Keywords: hplot +Description: Graphical Display of an Object of Class "ltraj" +URL: ../../../library/habitat/html/plot.ltraj.html + +Entry: plot.sahrlocs +Aliases: plot.sahrlocs, print.plotsahr +Keywords: hplot +Description: Exploratory Analysis of Habitat Selection +URL: ../../../library/habitat/html/plot.sahrlocs.html + +Entry: predict.enfa +Aliases: predict.enfa +Keywords: multivariate +Description: Habitat Suitability Maps Built from the ENFA +URL: ../../../library/habitat/html/predict.enfa.html + +Entry: puechabon +Aliases: puechabon +Keywords: datasets +Description: Radio-tracking of wild boars +URL: ../../../library/habitat/html/puechabon.html + +Entry: puechcirc +Aliases: puechcirc +Keywords: datasets +Description: +URL: ../../../library/habitat/html/puechdesIII.html + +Entry: puechdesIII +Aliases: puechdesIII +Keywords: datasets +Description: Habitat selection by the wild boar at Puechabon +URL: ../../../library/habitat/html/puechdesIII.html + +Entry: perarea +Aliases: perarea, ararea +Keywords: hplot +Description: Compute Areas and Perimeters of Objects of Class "area" +URL: ../../../library/habitat/html/perarea.html + +Entry: plot.area +Aliases: plot.area +Keywords: hplot +Description: Graphical Display of Objects of Class "area" +URL: ../../../library/habitat/html/plot.area.html + +Entry: rand.kselect +Aliases: rand.kselect, print.rand.kselect +Keywords: multivariate +Description: Test of the third order habitat selection +URL: ../../../library/habitat/html/rand.kselect.html + +Entry: randtest.enfa +Aliases: randtest.enfa +Keywords: multivariate +Description: {Randomisation Test for the Ecological Niche Factor Analysis +URL: ../../../library/habitat/html/randtest.enfa.html + +Entry: rotxy +Aliases: rotxy, .buffer.point.unic, profilehab +Keywords: internal +Description: internal functions for package habitat +URL: ../../../library/habitat/html/rotxy.html + +Entry: sahrlocs2kselect +Aliases: sahrlocs2kselect +Keywords: multivariate +Description: Preparation of a K-select analysis of radio-tracking data +URL: ../../../library/habitat/html/sahrlocs2kselect.html + +Entry: sahrlocs2niche +Aliases: sahrlocs2niche +Keywords: multivariate +Description: OMI Analysis of Radio-Tracking Data +URL: ../../../library/habitat/html/sahrlocs2niche.html + +Entry: scatter.enfa +Aliases: scatter.enfa +Keywords: multivariate +Description: Scatter Plot of the Results of the ENFA +URL: ../../../library/habitat/html/scatter.enfa.html + +Entry: schoener +Aliases: schoener, schoener.rtest +Keywords: math +Description: Compute Schoener's ratio +URL: ../../../library/habitat/html/schoener.html + +Entry: setmask +Aliases: setmask +Keywords: spatial +Description: Applies a Mask on Objects of Class "asc" or "kasc" +URL: ../../../library/habitat/html/setmask.html + +Entry: speed +Aliases: speed +Keywords: spatial +Description: Computes Speed Between Successive Relocations of an Animal +URL: ../../../library/habitat/html/speed.html + +Entry: squirrel +Aliases: squirrel +Keywords: dataset +Description: Radio-Tracking Data of Squirrels +URL: ../../../library/habitat/html/squirrel.html + +Entry: storemapattr +Aliases: storemapattr +Keywords: programming +Description: Store attributes of maps of class asc and kasc +URL: ../../../library/habitat/html/storemapattr.html + +Entry: subsetmap +Aliases: subsetmap,subsetmap.asc,subsetmap.kasc +Keywords: spatial +Description: Storing a part of a map +URL: ../../../library/habitat/html/subsetmap.html + +Entry: vanoise +Aliases: vanoise +Keywords: dataset +Description: Habitat Use by Three Species of Galliformes in the Vanoise National Parc +URL: ../../../library/habitat/html/vanoise.html + +Entry: wi +Aliases: wi, widesI, widesII, widesIII, print.wiI, print.wiII, print.wiIII, plot.wi, wiI, wiII +Keywords: hplot +Description: Computation of selection ratios for habitat selection studies +URL: ../../../library/habitat/html/wi.html diff --git a/DESCRIPTION b/DESCRIPTION index 794dfb4..4cfb250 100755 --- a/DESCRIPTION +++ b/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 -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 +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 diff --git a/INDEX b/INDEX index 97c5fe0..2caddf7 100755 --- a/INDEX +++ b/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. diff --git a/R/angles.r b/R/angles.r index d4b773e..1525a45 100755 --- a/R/angles.r +++ b/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) + } + diff --git a/R/as.ltraj.r b/R/as.ltraj.r index 480290b..72dcb2f 100755 --- a/R/as.ltraj.r +++ b/R/as.ltraj.r @@ -1,280 +1,215 @@ -as.ltraj <- function(xy, date, id, burst=id, slsp = c("remove", "missing")) -{ - if (!inherits(date,"POSIXct")) - stop("date should be of class \"POSIXct\"") - if (length(date) != nrow(xy)) - stop("date should be of the same length as xy") - id <- as.character(id) - burst <- as.character(burst) - if (length(id)>1) - stop("id should be of length 1") - x <- xy[,1] - y <- xy[,2] - res <- data.frame(x=x,y=y, date=date) - slsp <- match.arg(slsp) - - foo <- function(x) { - x1 <- x[-1, ] - x2 <- x[-nrow(x), ] - dist <- c(sqrt((x1$x - x2$x)^2 + (x1$y - x2$y)^2),NA) - R2n <- (x$x - x$x[1])^2 + (x$y - x$y[1])^2 - dt <- c(unclass(x1$date) - unclass(x2$date), NA) - dx <- c(x1$x - x2$x, NA) - dy <- c(x1$y - x2$y, NA) - abs.angle <- ifelse(dist<1e-07,NA,atan2(dy,dx)) - # angle absolu est NA si dx==dy==0 - so <- cbind.data.frame(dx=dx, dy=dy, dist=dist, - dt=dt, R2n=R2n, abs.angle=abs.angle) - return(so) - } - speed <- foo(res) - res <- cbind(res,speed) - - ang.rel <- function(df,slspi=slsp) { - ang <- NA - for(i in 2:(nrow(df)-1)){ - if(df$dist[i]>1e-07){ # deplacement en i - if(df$dist[i-1]>1e-07){ # deplacement en i-1 - x <- (df$dx[i]*df$dx[i-1]+df$dy[i]*df$dy[i-1])/ - sqrt(df$dx[i-1]^2+df$dy[i-1]^2) - y <- sqrt(df$dx[i]^2*df$dy[i-1]^2+df$dy[i]^2* - df$dx[i-1]^2-2*df$dx[i]*df$dx[i-1]* - df$dy[i-1]*df$dy[i])/sqrt(df$dx[i-1]^2+df$dy[i-1]^2) - deter <- df$dx[i-1]*df$dy[i]-df$dy[i-1]*df$dx[i] - angi <- atan2(sign(deter)*y,x) - } - else {#pas de deplacement en i-1 - if(slspi=="missing") { - # on met NA - angi <- NA - } - else{ # on recherche le premier vrai deplacement anterieur - j <- (i-1) - - while(df$dist[j]<1e-07){ - if (j<1){ - j <- NA - break - } - j <- (j-1) - } - if(is.na(j)){ - angi <- NA} - else{ - x <- (df$dx[i]*df$dx[j]+df$dy[i]*df$dy[j])/ - sqrt(df$dx[j]^2+df$dy[j]^2) - y <- sqrt(df$dx[i]^2*df$dy[j]^2+df$dy[i]^2* - df$dx[j]^2-2*df$dx[i]*df$dx[j]*df$dy[j]*df$dy[i])/ - sqrt(df$dx[j]^2+df$dy[j]^2) - deter <- df$dx[j]*df$dy[i]-df$dy[j]*df$dx[i] - angi <- atan2(sign(deter)*y,x) - } - } - } - } - else {angi<-NA} # pas de deplacement en i - ang <- c(ang,angi) - } - ang <- c(ang,NA) - return(ang) - } - rel.angle <- ang.rel(res) - res <- data.frame(res, rel.angle=rel.angle) - res <- list(data.frame(res)) - attr(res[[1]],"id") <- id - attr(res[[1]],"burst") <- burst - class(res) <- c("ltraj","list") - return(res) -} - - - -"[.ltraj" <- function(x, i, id, burst) - { - if (!inherits(x, "ltraj")) - stop("x should be of class \"ltraj\"") - if (sum((!missing(i))+(!missing(id))+(!missing(burst)))!=1) - stop("non convenient subset") - x <- unclass(x) - - if (!missing(i)) - y <- x[i] - if (!missing(id)) { - idb <- unlist(lapply(x,function(z) attr(z,"id"))) - y <- x[idb%in%id] - } - if (!missing(burst)) { - idb <- unlist(lapply(x,function(z) attr(z,"burst"))) - y <- x[idb%in%burst] - } - class(y) <- c("ltraj","list") - return(y) - } - - - -"[<-.ltraj" <- function(x, i, id, burst, value) - { - if (!inherits(x, "ltraj")) - stop("x should be of class \"ltraj\"") - if (sum((!missing(i))+(!missing(id))+(!missing(burst)))!=1) - stop("non convenient subset") - x <- unclass(x) - - if (!missing(i)) - x[i] <- value - if (!missing(id)) { - idb <- unlist(lapply(x,function(z) attr(z,"id"))) - x[idb%in%id] <- value - } - if (!missing(burst)) { - idb <- unlist(lapply(x,function(z) attr(z,"burst"))) - x[idb%in%burst] <- value - } - class(x) <- c("ltraj","list") - bu <- unlist(lapply(x, function(y) attr(y, "burst"))) - if (length(unique(bu))!=length(bu)) - stop("attribute \"burst\" should be unique for a burst of relocations") - return(x) - } - - -summary.ltraj <- function(object,...) - { - if (!inherits(object, "ltraj")) - stop("object should be of class \"ltraj\"") - id <- factor(unlist(lapply(object, function(x) attr(x, "id")))) - burst <- unlist(lapply(object, function(x) attr(x, "burst"))) - nr <- unlist(lapply(object, nrow)) - pr <- data.frame(id=id, burst=burst, number.of.relocations=nr) - return(pr) - } - -print.ltraj <- function(x,...) - { - if (!inherits(x, "ltraj")) - stop("x should be of class \"ltraj\"") - pr <- summary(x) - cat("*********** List of class ltraj ***********\n\n") - cat("characteristics of the bursts:\n") - print(pr) - } - - -traj2ltraj <- function(traj,slsp = c("remove", "missing")) - { - if (!inherits(traj, "traj")) - stop("traj should be of class \"traj\"") - slsp <- match.arg(slsp) - traj <- traj2df(traj) - res <- split(traj, traj$burst) - foo <- function(x) { - x1 <- x[-1, ] - x2 <- x[-nrow(x), ] - dist <- c(sqrt((x1$x - x2$x)^2 + (x1$y - x2$y)^2),NA) - dt <- c(unclass(x1$date) - unclass(x2$date), NA) - dx <- c(x1$x - x2$x, NA) - dy <- c(x1$y - x2$y, NA) - abs.angle <- ifelse((abs(dx)<1e-07)&(abs(dy)<1e-07), - NA,atan2(dy,dx)) - # angle absolu est NA si dx==dy==0 - so <- cbind.data.frame(dx=dx, dy=dy, dist=dist, - dt=dt,abs.angle=abs.angle) - return(so) - } - speed <- lapply(res, foo) - res <- lapply(1:length(res), - function(i) cbind(res[[i]],speed[[i]])) - - ang.rel <- function(df,slspi=slsp) { - ang <- NA - for(i in 2:(nrow(df)-1)){ - if(df$dist[i]>1e-07){ # deplacement en i - if(df$dist[i-1]>1e-07){ # deplacement en i-1 - x <- (df$dx[i]*df$dx[i-1]+df$dy[i]*df$dy[i-1])/ - sqrt(df$dx[i-1]^2+df$dy[i-1]^2) - y <- sqrt(df$dx[i]^2*df$dy[i-1]^2+df$dy[i]^2*df$dx[i-1]^2- - 2*df$dx[i]*df$dx[i-1]*df$dy[i-1]*df$dy[i])/ - sqrt(df$dx[i-1]^2+df$dy[i-1]^2) - deter <- df$dx[i-1]*df$dy[i]-df$dy[i-1]*df$dx[i] - angi <- atan2(sign(deter)*y,x) - } - else {#pas de deplacement en i-1 - if(slspi=="missing") { - # on met NA - angi <- NA - } - else{ # on recherche le premier vrai deplacement anterieur - j <- (i-1) - - while(df$dist[j]<1e-07){ - if (j<1){ - j <- NA - break - } - j <- (j-1) - } - if(is.na(j)){ - angi <- NA} - else{ - x <- (df$dx[i]*df$dx[j]+df$dy[i]*df$dy[j])/ - sqrt(df$dx[j]^2+df$dy[j]^2) - y <- sqrt(df$dx[i]^2*df$dy[j]^2+df$dy[i]^2* - df$dx[j]^2-2*df$dx[i]*df$dx[j]* - df$dy[j]*df$dy[i])/sqrt(df$dx[j]^2+df$dy[j]^2) - deter <- df$dx[j]*df$dy[i]-df$dy[j]*df$dx[i] - angi <- atan2(sign(deter)*y,x) - } - } - } - } - else {angi<-NA} # pas de deplacement en i - ang <- c(ang,angi) - } - ang <- c(ang,NA) - return(ang) - } - - rel.angle <- lapply(res, ang.rel) - res <- lapply(1:length(res), - function(i) data.frame(res[[i]], - rel.angle=rel.angle[[i]])) - res <- lapply(res, function(x) { - attr(x,"id") <- as.character(x$id[1]) - attr(x,"burst") <- as.character(x$burst[1]) - x$id <- NULL - x$burst <- NULL - return(x) - }) - class(res) <- c("ltraj","list") - return(res) - } - - -ltraj2traj <- function(x) - { - if (!inherits(x, "ltraj")) - stop("x should be of class \"traj\"") - id <- factor(unlist(lapply(x, function(y) - id <- rep(attr(y,"id"), nrow(y))))) - burst <- factor(unlist(lapply(x, function(y) - id <- rep(attr(y,"burst"), nrow(y))))) - res <- do.call("rbind", x) - res <- cbind(id,burst,res) - class(res) <- c("traj","data.frame") - return(res) - } - -c.ltraj <- function(...) - { - uu <- list(...) - if (!all(unlist(lapply(uu, function(x) inherits(x,"ltraj"))))) - stop("all objects should be of class \"ltraj\"") - bu <- unlist(lapply(uu, function(x) unlist(lapply(x, function(y) attr(y, "burst"))))) - if (length(unique(bu))!=length(bu)) - stop("attribute \"burst\" should be unique for a burst of relocations") - uu <- lapply(uu, unclass) - uu <- do.call("c",uu) - class(uu) <- c("ltraj","list") - return(uu) - } +as.ltraj <- function(xy, date, id, burst=id, slsp = c("remove", "missing")) +{ + if (!inherits(date,"POSIXct")) + stop("date should be of class \"POSIXct\"") + if (length(date) != nrow(xy)) + stop("date should be of the same length as xy") + + slsp <- match.arg(slsp) + + ## longueur de id + if (length(id)==1) + id <- rep(as.character(id), nrow(xy)) + if (length(id)!=nrow(xy)) + stop("id should be of the same length as xy, or of length 1") + id <- as.character(id) + + ## longueur de burst + if (length(burst)==1) + burst <- rep(as.character(burst), nrow(xy)) + if (length(burst)!=nrow(xy)) + stop("burst should be of the same length as xy, or of length 1") + burst <- as.character(burst) + + ## Vérification de l'unicité des bursts pour chaque id + id1 <- factor(id) + burst1 <- factor(burst) + if (!all(apply(table(id1,burst1)>0,2,sum)==1)) + stop("one burst level should belong to only one id level") + + x <- xy[,1] + y <- xy[,2] + res <- split(data.frame(x=x,y=y, date=date), burst) + liid <- split(id, burst) + + ## Tri des dates + res <- lapply(res, function(y) y[order(y$date),]) + + ## Vérification que pas de doublons des dates + rr <- any(unlist(lapply(res, + function(x) (length(unique(x$date))!=length(x$date))))) + if (rr) + stop("non unique dates for a given burst") + + + + ## Calcul des descripteurs + foo <- function(x) { + x1 <- x[-1, ] + x2 <- x[-nrow(x), ] + dist <- c(sqrt((x1$x - x2$x)^2 + (x1$y - x2$y)^2),NA) + R2n <- (x$x - x$x[1])^2 + (x$y - x$y[1])^2 + dt <- c(unclass(x1$date) - unclass(x2$date), NA) + dx <- c(x1$x - x2$x, NA) + dy <- c(x1$y - x2$y, NA) + abs.angle <- ifelse(dist<1e-07,NA,atan2(dy,dx)) + ## angle absolu est NA si dx==dy==0 + so <- cbind.data.frame(dx=dx, dy=dy, dist=dist, + dt=dt, R2n=R2n, abs.angle=abs.angle) + return(so) + } + speed <- lapply(res, foo) + res <- lapply(1:length(res), function(i) cbind(res[[i]],speed[[i]])) + + ang.rel <- function(df,slspi=slsp) { + ang1 <- df$abs.angle[-nrow(df)] # angle i-1 + ang2 <- df$abs.angle[-1] # angle i + + if(slspi=="remove"){ + dist <- c(sqrt((df[-nrow(df),"x"] - df[-1,"x"])^2 + (df[-nrow(df),"y"] - df[-1,"y"])^2),NA) + wh.na <- which(dist<1e-7) + if(length(wh.na)>0){ + no.na <- (1:length(ang1))[!(1:length(ang1)) %in% wh.na] + for (i in wh.na){ + indx <- no.na[no.na pi, res -2*pi,res) + return(c(NA,res)) + } + rel.angle <- lapply(res, ang.rel) + res <- lapply(1:length(res), + function(i) data.frame(res[[i]], rel.angle=rel.angle[[i]])) + res <- lapply(1:length(res), function(i) { + x <- res[[i]] + attr(x, "id") <- as.character(liid[[i]][1]) + attr(x,"burst") <- levels(factor(burst))[i] + return(x) + }) + class(res) <- c("ltraj","list") + return(res) +} + + + + + +traj2ltraj <- function(traj,slsp = c("remove", "missing")) + { + if (!inherits(traj, "traj")) + stop("traj should be of class \"traj\"") + slsp <- match.arg(slsp) + traj <- traj2df(traj) + res <- as.ltraj(xy=traj[,c("x","y")], date=traj$date, id=traj$id, + burst=traj$burst, slsp) + return(res) + } + + + + +"[.ltraj" <- function(x, i, id, burst) + { + if (!inherits(x, "ltraj")) + stop("x should be of class \"ltraj\"") + if (sum((!missing(i))+(!missing(id))+(!missing(burst)))!=1) + stop("non convenient subset") + x <- unclass(x) + + if (!missing(i)) + y <- x[i] + if (!missing(id)) { + idb <- unlist(lapply(x,function(z) attr(z,"id"))) + y <- x[idb%in%id] + } + if (!missing(burst)) { + idb <- unlist(lapply(x,function(z) attr(z,"burst"))) + y <- x[idb%in%burst] + } + class(y) <- c("ltraj","list") + return(y) + } + + + +"[<-.ltraj" <- function(x, i, id, burst, value) + { + if (!inherits(x, "ltraj")) + stop("x should be of class \"ltraj\"") + if (sum((!missing(i))+(!missing(id))+(!missing(burst)))!=1) + stop("non convenient subset") + x <- unclass(x) + + if (!missing(i)) + x[i] <- value + if (!missing(id)) { + idb <- unlist(lapply(x,function(z) attr(z,"id"))) + x[idb%in%id] <- value + } + if (!missing(burst)) { + idb <- unlist(lapply(x,function(z) attr(z,"burst"))) + x[idb%in%burst] <- value + } + class(x) <- c("ltraj","list") + bu <- unlist(lapply(x, function(y) attr(y, "burst"))) + if (length(unique(bu))!=length(bu)) + stop("attribute \"burst\" should be unique for a burst of relocations") + return(x) + } + + +summary.ltraj <- function(object,...) + { + if (!inherits(object, "ltraj")) + stop("object should be of class \"ltraj\"") + id <- factor(unlist(lapply(object, function(x) attr(x, "id")))) + burst <- unlist(lapply(object, function(x) attr(x, "burst"))) + nr <- unlist(lapply(object, nrow)) + na <- unlist(lapply(object, function(i) sum(is.na(i[,1])))) + pr <- data.frame(id=id, burst=burst, number.of.relocations=nr, missing.values=na) + return(pr) + } + +print.ltraj <- function(x,...) + { + if (!inherits(x, "ltraj")) + stop("x should be of class \"ltraj\"") + pr <- summary(x) + cat("*********** List of class ltraj ***********\n\n") + cat("characteristics of the bursts:\n") + print(pr) + } + + + +ltraj2traj <- function(x) + { + if (!inherits(x, "ltraj")) + stop("x should be of class \"ltraj\"") + id <- factor(unlist(lapply(x, function(y) + id <- rep(attr(y,"id"), nrow(y))))) + burst <- factor(unlist(lapply(x, function(y) + id <- rep(attr(y,"burst"), nrow(y))))) + res <- do.call("rbind", x) + res <- cbind(id,burst,res) + class(res) <- c("traj","data.frame") + return(res) + } + +c.ltraj <- function(...) + { + uu <- list(...) + if (!all(unlist(lapply(uu, function(x) inherits(x,"ltraj"))))) + stop("all objects should be of class \"ltraj\"") + bu <- unlist(lapply(uu, function(x) unlist(lapply(x, function(y) attr(y, "burst"))))) + if (length(unique(bu))!=length(bu)) + stop("attribute \"burst\" should be unique for a burst of relocations") + uu <- lapply(uu, unclass) + uu <- do.call("c",uu) + class(uu) <- c("ltraj","list") + return(uu) + } diff --git a/R/as.traj.r b/R/as.traj.r index 0fad8b1..321ed0c 100755 --- a/R/as.traj.r +++ b/R/as.traj.r @@ -35,6 +35,8 @@ function(id, xy, date, burst=id, ...) li<-lapply(li, foob) bas<-do.call("rbind", li) row.names(bas)<-as.character(1:nrow(bas)) + bas$id <- factor(bas$id) + bas$burst <- factor(bas$burst) class(bas)<-c("traj", "data.frame") return(bas) } diff --git a/R/debut.r b/R/debut.r index 570be2d..f4521e3 100755 --- a/R/debut.r +++ b/R/debut.r @@ -1,10 +1,9 @@ -##### Chargement de base - -cat("This package requires ade4 to be installed\n\n") -require(ade4) -require(gpclib) - -.First.lib <- function(lib, pkg) { - library.dynam("adehabitat", pkg, lib) -} - +##### Chargement de base + +.First.lib <- function(lib, pkg) { + cat("This package requires ade4 to be installed\n\n") + require(ade4) + require(gpclib) + library.dynam("adehabitat", pkg, lib) +} + diff --git a/R/eisera.r b/R/eisera.r index 527da04..c7db069 100755 --- a/R/eisera.r +++ b/R/eisera.r @@ -1,77 +1,77 @@ - -eisera <- function(used, available, scannf = TRUE, nf = 2) - { - if (!all(dim(used)==dim(available))) - stop("used and available should have the same dimension") - ut <- as.matrix(used) - av <- as.matrix(available) - av <- av/apply(av,1,sum) - wij <- ut/apply(ut,1,sum)/av - 1 - wij[av<1e-07] <- 0 - mT <- sqrt(av)*wij - D <- apply(ut,1,sum) - o <- as.dudi(as.data.frame(mT), rep(1,ncol(ut)), D, - scannf, nf, call=match.call(), type="esr") - uuu <- wij - uuv <- apply(uuu,2,function(x) x*o$lw) - o$co <- t(as.matrix(uuv))%*%as.matrix(o$l1) - o$c1 <- NULL - o$available <- as.data.frame(av) - o$used <- as.data.frame(ut) - o$wij <- ut/apply(ut,1,sum)/av - return(o) - } - -print.esr <- function (x, ...) -{ - cat("Factorial analysis of selection ratios\n") - cat("\n$call: ") - print(x$call) - cat("\n$nf:", x$nf, "axis-components saved") - cat("\n$rank: ") - cat(x$rank) - cat("\neigen values: ") - l0 <- length(x$eig) - cat(signif(x$eig, 4)[1:(min(5, l0))]) - if (l0 > 5) - cat(" ...\n") - else cat("\n") - sumry <- array("", c(3, 4), list(1:3, c("vector", "length", - "mode", "content"))) - sumry[1, ] <- c("$cw", length(x$cw), mode(x$cw), "column weights") - sumry[2, ] <- c("$lw", length(x$lw), mode(x$lw), "row weights") - sumry[3, ] <- c("$eig", length(x$eig), mode(x$eig), "eigen values") - class(sumry) <- "table" - print(sumry) - cat("\n") - sumry <- array("", c(6, 4), list(1:6, c("data.frame", "nrow", - "ncol", "content"))) - sumry[1, ] <- c("$tab", nrow(x$tab), ncol(x$tab), "modified array") - sumry[2, ] <- c("$li", nrow(x$li), ncol(x$li), "row coordinates") - sumry[3, ] <- c("$co", nrow(x$co), ncol(x$co), "column coordinates") - sumry[4, ] <- c("$available", nrow(x$available), ncol(x$available), - "available proportions") - sumry[5, ] <- c("$used", nrow(x$used), ncol(x$used), "number of relocations") - sumry[6, ] <- c("$wij", nrow(x$used), ncol(x$used), "selection ratios") - - class(sumry) <- "table" - print(sumry) -} - - -scatter.esr <- function(x, xax = 1, yax = 2, csub = 1, - possub = "bottomleft", ...) - { - if (!inherits(x, "esr")) - stop("x should be of class \"esr\"") - - opar <- par(mfrow=c(2,1), mar=c(0,0,0,0)) - s.label(x$co, xax = xax, yax = yax, ...) - if (csub > 0) - scatterutil.sub("Habitat types", csub, possub) - s.arrow(x$li, xax = xax, yax = yax, ...) - if (csub > 0) - scatterutil.sub("Animals", csub, possub) - par(opar) - } - + +eisera <- function(used, available, scannf = TRUE, nf = 2) + { + if (!all(dim(used)==dim(available))) + stop("used and available should have the same dimension") + ut <- as.matrix(used) + av <- as.matrix(available) + av <- av/apply(av,1,sum) + wij <- ut/apply(ut,1,sum)/av - 1 + wij[av<1e-07] <- 0 + mT <- sqrt(av)*wij + D <- apply(ut,1,sum) + o <- as.dudi(as.data.frame(mT), rep(1,ncol(ut)), D, + scannf, nf, call=match.call(), type="esr") + uuu <- wij + uuv <- apply(uuu,2,function(x) x*o$lw) + o$co <- t(as.matrix(uuv))%*%as.matrix(o$l1) + o$c1 <- NULL + o$available <- as.data.frame(av) + o$used <- as.data.frame(ut) + o$wij <- ut/apply(ut,1,sum)/av + return(o) + } + +print.esr <- function (x, ...) +{ + cat("Factorial analysis of selection ratios\n") + cat("\n$call: ") + print(x$call) + cat("\n$nf:", x$nf, "axis-components saved") + cat("\n$rank: ") + cat(x$rank) + cat("\neigen values: ") + l0 <- length(x$eig) + cat(signif(x$eig, 4)[1:(min(5, l0))]) + if (l0 > 5) + cat(" ...\n") + else cat("\n") + sumry <- array("", c(3, 4), list(1:3, c("vector", "length", + "mode", "content"))) + sumry[1, ] <- c("$cw", length(x$cw), mode(x$cw), "column weights") + sumry[2, ] <- c("$lw", length(x$lw), mode(x$lw), "row weights") + sumry[3, ] <- c("$eig", length(x$eig), mode(x$eig), "eigen values") + class(sumry) <- "table" + print(sumry) + cat("\n") + sumry <- array("", c(6, 4), list(1:6, c("data.frame", "nrow", + "ncol", "content"))) + sumry[1, ] <- c("$tab", nrow(x$tab), ncol(x$tab), "modified array") + sumry[2, ] <- c("$li", nrow(x$li), ncol(x$li), "row coordinates") + sumry[3, ] <- c("$co", nrow(x$co), ncol(x$co), "column coordinates") + sumry[4, ] <- c("$available", nrow(x$available), ncol(x$available), + "available proportions") + sumry[5, ] <- c("$used", nrow(x$used), ncol(x$used), "number of relocations") + sumry[6, ] <- c("$wij", nrow(x$used), ncol(x$used), "selection ratios") + + class(sumry) <- "table" + print(sumry) +} + + +scatter.esr <- function(x, xax = 1, yax = 2, csub = 1, + possub = "bottomleft", ...) + { + if (!inherits(x, "esr")) + stop("x should be of class \"esr\"") + + opar <- par(mfrow=c(2,1), mar=c(0,0,0,0)) + s.label(x$co, xax = xax, yax = yax, ...) + if (csub > 0) + scatterutil.sub("Habitat types", csub, possub) + s.arrow(x$li, xax = xax, yax = yax, ...) + if (csub > 0) + scatterutil.sub("Animals", csub, possub) + par(opar) + } + diff --git a/R/enfa.r b/R/enfa.r index 3269105..aba2b0b 100755 --- a/R/enfa.r +++ b/R/enfa.r @@ -6,6 +6,8 @@ function (tab, pr, scannf = TRUE, nf = 1) stop("na entries in table") if (!is.vector(pr)) stop("pr should be a vector") + if (any(unlist(lapply(tab, is.factor)))) + stop("factors not yet implemented") row.w <- rep(1, nrow(tab))/nrow(tab) f1 <- function(v) sum(v * row.w)/sum(row.w) f2 <- function(v) sqrt(sum(v * v * row.w)/sum(row.w)) diff --git a/R/gdltraj.r b/R/gdltraj.r index 9731111..89f38b8 100755 --- a/R/gdltraj.r +++ b/R/gdltraj.r @@ -1,21 +1,21 @@ -gdltraj <- function(x, min, max, - type=c("POSIXct","sec","min","hour", - "mday","mon","year","wday","yday")) - { - if (!inherits(x, "ltraj")) - stop("x should be of class \"ltraj\"") - type <- match.arg(type) - if (type=="POSIXct") { - x <- lapply(x, function(y) y[(y$date>min)&(y$date=min)&(damin)&(y$date=min)&(dalev]<-NA ud[!is.na(ud)]<-1 + jj <- labcon(ud) + jj <- table(factor(c(jj))) + if (any(jj<4)) + stop("Some parts of the home range contain less than 3 pixels. +Increase the size of the grid used for the estimation in +the function 'kernelUD' (parameter 'grid') and try again") contour[[i]]<-getcontour(ud) } names(contour)<-names(x) diff --git a/R/kernelbb.r b/R/kernelbb.r index beea517..8a251b0 100755 --- a/R/kernelbb.r +++ b/R/kernelbb.r @@ -1,9 +1,9 @@ "kernelbb" <- function(tr, sig1, sig2, grid = 40, same4all=FALSE, byburst=FALSE) { - x <- tr + x <- ltraj2traj(tr) if (!inherits(x, "traj")) - stop("x should be of class \"traj\"") + stop("tr should be of class \"ltraj\"") sorties <- list() gr <- grid xy<-x[,c("x","y")] diff --git a/R/ltraj2sldf.r b/R/ltraj2sldf.r new file mode 100755 index 0000000..fa17b47 --- /dev/null +++ b/R/ltraj2sldf.r @@ -0,0 +1,27 @@ +"ltraj2sldf" <- + function(ltr, byid = FALSE) + { + if (!inherits(ltr, "ltraj")) + stop("ltr should be of class \"ltraj\"") + lixy <- lapply(ltr, + function(x) Line(as.matrix(x[!is.na(x$x),c("x","y")]))) + id <- unlist(lapply(ltr, function(x) attr(x, "id"))) + bu <- unlist(lapply(ltr, function(x) attr(x, "burst"))) + + if (byid) { + lev <- levels(factor(id)) + re1 <- lapply(lev, function(x) Lines(lixy[id==x], ID=x)) + res <- SpatialLines(re1) + df <- data.frame(id=lev) + row.names(df) <- lev + } else { + res <- lapply(1:length(lixy), + function(i) Lines(list(lixy[[i]]), ID=bu[i])) + res <- SpatialLines(res) + df <- data.frame(id=id, burst=bu) + row.names(df) <- bu + } + res <- SpatialLinesDataFrame(res, data=df) + return(res) + } + diff --git a/R/ltraj2spdf.r b/R/ltraj2spdf.r new file mode 100755 index 0000000..a66662d --- /dev/null +++ b/R/ltraj2spdf.r @@ -0,0 +1,14 @@ +"ltraj2spdf" <- +function(ltr) + { + if (!inherits(ltr, "ltraj")) + stop("ltr should be of class \"ltraj\"") + tr <- do.call("rbind", ltr) + class(tr) <- "data.frame" + xy <- tr[!is.na(tr$x),c("x","y")] + tr <- tr[!is.na(tr$x),] + tr$y <- tr$x <- NULL + res <- SpatialPointsDataFrame(xy, tr) + return(res) + } + diff --git a/R/plot.hrsize.r b/R/plot.hrsize.r index 8c3d76d..c33630f 100755 --- a/R/plot.hrsize.r +++ b/R/plot.hrsize.r @@ -1,18 +1,23 @@ -"plot.hrsize" <- -function(x, ...) - { +plot.hrsize <- function (x, ...) +{ if (!inherits(x, "hrsize")) - stop("should be of class hrsize") - opar<-par(mfrow=n2mfrow(ncol(x))) + stop("should be of class hrsize") + opar <- par(mfrow = n2mfrow(ncol(x))) on.exit(par(opar)) - for (i in 1:ncol(x)) { - plot(as.numeric(row.names(x)), - x[,i], - main=names(x)[i], pch=16, cex=0.5, - xlab="Home-range level", - ylab=paste("Home-range size (",attr(x, "units"),")",sep="")) - lines(as.numeric(row.names(x)), - x[,i]) + if (!is.null(attr(x, "xlabel"))) { + xlabel <- attr(x, "xlabel") + } else { + xlabel <- "Home-range level" + } + if (!is.null(attr(x, "ylabel"))) { + ylabel <- attr(x, "ylabel") + } else { + ylabel <- paste("Home-range size (", attr(x, "units"), ")", sep = "") } - } + for (i in 1:ncol(x)) { + plot(as.numeric(row.names(x)), x[, i], main = names(x)[i], + pch = 16, cex = 0.5, xlab = xlabel, ylab = ylabel) + lines(as.numeric(row.names(x)), x[, i]) + } +} diff --git a/R/plot.ltraj.r b/R/plot.ltraj.r index a0ba536..ff5f1e1 100755 --- a/R/plot.ltraj.r +++ b/R/plot.ltraj.r @@ -1,79 +1,104 @@ -plot.ltraj <- function (x, id = unique(unlist(lapply(x, attr, which="id"))), - burst = unlist(lapply(x, attr, which="burst")), - asc = NULL, area = NULL, xlim = NULL, - ylim = NULL, colasc = gray((240:1)/256), - colpol = "green", addpoints = TRUE, - addlines = TRUE, perani = TRUE, final = TRUE, ...) -{ - polygon <- area - if (!is.null(area)) { - if (!inherits(area, "area")) - stop("area should be an object of class area") - } - if (!inherits(x, "ltraj")) - stop("x should be an object of class ltraj") - id <- id - burst <- burst - x <- ltraj2traj(x) - if (is.null(xlim)) - xlim <- range(x$x) - if (is.null(ylim)) - ylim <- range(x$y) - - i <- split(x, x$id) - x <- do.call("rbind", i[id]) - x$id <- factor(x$id) - x$burst <- factor(x$burst) - bu <- levels(x$burst) - burst <- burst[burst%in%bu] - - i <- split(x, x$burst) - x <- do.call("rbind", i[burst]) - x$id <- factor(x$id) - x$burst <- factor(x$burst) - - if (!perani) - idc <- "burst" - else idc <- "id" - li <- split(x, x[[idc]]) - id <- levels(x[[idc]]) - if (length(li)>1) - opar <- par(mar = c(0.1, 0.1, 2, 0.1), mfrow = n2mfrow(length(li))) - m <- unlist(lapply(li, function(x) mean(x$date))) - nli <- names(li) - nli <- nli[order(m)] - for (i in nli) { - if (!is.null(asc)) - image(asc, col = colasc, xlim = xlim, ylim = ylim, - main = i, - axes = (length(li)==1), ...) - else plot(x$x, x$y, type = "n", asp = 1, xlim = xlim, - ylim = ylim, axes = (length(li)==1), - main = i, ...) - box() - if (!is.null(polygon)) { - pol <- split(polygon[, 2:3], factor(polygon[, 1])) - for (j in 1:length(pol)) polygon(pol[[j]], col = colpol) - } - if (addlines) { - for (j in levels(factor(li[[i]]$burst))) { - lines(x$x[x$burst == j], x$y[x$burst == j]) - } - } - if (addpoints) { - for (j in levels(factor(li[[i]]$burst))) { - points(x$x[x$burst == j], x$y[x$burst == j], - pch = 21, col = "black", bg = "white") - } - } - if (final) { - for (j in levels(factor(li[[i]]$burst))) { - points(x$x[x$burst == j][c(1, length(x$x[x$burst == - j]))], x$y[x$burst == j][c(1, length(x$y[x$burst == - j]))], pch = 14, col = c("blue", "red")) - } - } - } - if (length(li)>1) - par(opar) -} +plot.ltraj <- function (x, id = unique(unlist(lapply(x, attr, which="id"))), + burst = unlist(lapply(x, attr, which="burst")), + asc = NULL, area = NULL, xlim = NULL, + ylim = NULL, colasc = gray((240:1)/256), + colpol = "green", addpoints = TRUE, + addlines = TRUE, perani = TRUE, final = TRUE, ...) +{ + polygon <- area + if (!is.null(area)) { + if (!inherits(area, "area")) + stop("area should be an object of class area") + } + if (!inherits(x, "ltraj")) + stop("x should be an object of class ltraj") + + ## supprimer les NA + x <- lapply(x, function(i) { + jj <- i[!is.na(i$x),] + attr(jj, "id") <- attr(i,"id") + attr(jj, "burst") <- attr(i,"burst") + return(jj) + }) + class(x) <- c("ltraj","list") + id <- id + burst <- burst + x <- ltraj2traj(x) + i <- split(x, x$id) + x <- do.call("rbind", i[id]) + x$id <- factor(x$id) + x$burst <- factor(x$burst) + bu <- levels(x$burst) + burst <- burst[burst%in%bu] + + i <- split(x, x$burst) + x <- do.call("rbind", i[burst]) + x$id <- factor(x$id) + x$burst <- factor(x$burst) + + if (!perani) + idc <- "burst" + else idc <- "id" + li <- split(x, x[[idc]]) + id <- levels(x[[idc]]) + if (length(li)>1) + opar <- par(mar = c(0.1, 0.1, 2, 0.1), mfrow = n2mfrow(length(li))) + m <- unlist(lapply(li, function(x) mean(x$date))) + nli <- names(li) + nli <- nli[order(m)] + + if (is.null(xlim)) { + maxxl <- max(unlist(lapply(li, function(ki) range(ki$x)[2] - range(ki$x)[1]))) + xlim <- lapply(li, function(ki) c(min(ki$x), min(ki$x)+maxxl)) + } else { + ma <- max(unlist(lapply(li, function(ki) range(ki$x)[2]))) + mi <- min(unlist(lapply(li, function(ki) range(ki$x)[1]))) + xlim <- lapply(li, function(ki) c(mi,ma)) + } + if (is.null(ylim)) { + maxyl <- max(unlist(lapply(li, function(ki) range(ki$y)[2] - range(ki$y)[1]))) + ylim <- lapply(li, function(ki) c(min(ki$y), min(ki$y)+maxyl)) + } else { + ma <- max(unlist(lapply(li, function(i) range(ki$y)[2]))) + mi <- min(unlist(lapply(li, function(i) range(ki$y)[1]))) + ylim <- lapply(li, function(ki) c(mi,ma)) + } + names(xlim) <- names(li) + names(ylim) <- names(li) + + for (i in nli) { + if (!is.null(asc)) + image(asc, col = colasc, xlim = xlim[i][[1]], ylim = ylim[i][[1]], + main = i, + axes = (length(li)==1), ...) + else plot(li[i][[1]]$x, li[i][[1]]$y, type = "n", asp = 1, + xlim = xlim[i][[1]], + ylim = ylim[i][[1]], axes = (length(li)==1), + main = i, ...) + box() + if (!is.null(polygon)) { + pol <- split(polygon[, 2:3], factor(polygon[, 1])) + for (j in 1:length(pol)) polygon(pol[[j]], col = colpol) + } + if (addlines) { + for (j in levels(factor(li[[i]]$burst))) { + lines(x$x[x$burst == j], x$y[x$burst == j]) + } + } + if (addpoints) { + for (j in levels(factor(li[[i]]$burst))) { + points(x$x[x$burst == j], x$y[x$burst == j], + pch = 21, col = "black", bg = "white") + } + } + if (final) { + for (j in levels(factor(li[[i]]$burst))) { + points(x$x[x$burst == j][c(1, length(x$x[x$burst == + j]))], x$y[x$burst == j][c(1, length(x$y[x$burst == + j]))], pch = 14, col = c("blue", "red")) + } + } + } + if (length(li)>1) + par(opar) +} diff --git a/R/print.wiII.r b/R/print.wiII.r index d8b085d..3cb5ee2 100755 --- a/R/print.wiII.r +++ b/R/print.wiII.r @@ -5,7 +5,7 @@ function(x, ...) stop("x should be of class \"wiII\"") cat("\n\n************** Manly's Selection ratios for design II ********\n\n") cat("1. Test of identical use of habitat by all animals\n") - cat(" (Classical Khi² performed on the used matrix):\n") + cat(" (Classical Khi-2 performed on the used matrix):\n") print(x$Khi2L1) cat("2. Test of overall habitat selection:\n") diff --git a/R/rec.r b/R/rec.r new file mode 100755 index 0000000..2d15324 --- /dev/null +++ b/R/rec.r @@ -0,0 +1,9 @@ +rec <- function(x, slsp=c("remove","missing")) + { + if (!inherits(x, "ltraj")) + stop("x should be of class \"ltraj\"") + slsp <- match.arg(slsp) + y <- traj2df(ltraj2traj(x)) + return(as.ltraj(xy=y[,c("x","y")], date=y$date, + id=y$id, burst=y$burst, slsp=slsp)) + } diff --git a/R/speed.r b/R/speed.r index 2ae3448..dd24c8d 100755 --- a/R/speed.r +++ b/R/speed.r @@ -1,36 +1,36 @@ -"speed" <- -function(x, id=levels(x$id), burst=levels(x$burst), - date=NULL, units=c("seconds", "hours","days")) - { - .Deprecated("as.ltraj") - if (!inherits(x, "traj")) - stop("should be an object of class traj") - units<-match.arg(units) - - ## sélection des dates - x<-getburst(x, burst=burst, id=id, date=date) - - ## Calcul des distances entre locs successives - li<-split(x, x$burst) - foo<-function(x) { - x1<-x[-1,] - x2<-x[-nrow(x),] - dist<-sqrt( (x1$x-x2$x)^2 + (x1$y-x2$y)^2) - hour<-(unclass(x1$date)-unclass(x2$date)) - if (units=="hours") - hour<-(unclass(x1$date)-unclass(x2$date))/3600 - if (units=="days") - hour<-(unclass(x1$date)-unclass(x2$date))/(3600*24) - disx<-(x1$x-x2$x) - disy<-(x1$y-x2$y) - so<-cbind.data.frame(id=x2$id,x=x2$x, y=x2$y, date=x2$date, - burst=x2$burst, - sp.x=disx/hour, sp.y=disy/hour, - speed=dist/hour, dt=hour) - return(so) - } - lo<-do.call("rbind", lapply(li, foo)) - row.names(lo)<-1:nrow(lo) - return(lo) - } - +"speed" <- +function(x, id=levels(x$id), burst=levels(x$burst), + date=NULL, units=c("seconds", "hours","days")) + { + .Deprecated("as.ltraj") + if (!inherits(x, "traj")) + stop("should be an object of class traj") + units<-match.arg(units) + + ## sélection des dates + x<-getburst(x, burst=burst, id=id, date=date) + + ## Calcul des distances entre locs successives + li<-split(x, x$burst) + foo<-function(x) { + x1<-x[-1,] + x2<-x[-nrow(x),] + dist<-sqrt( (x1$x-x2$x)^2 + (x1$y-x2$y)^2) + hour<-(unclass(x1$date)-unclass(x2$date)) + if (units=="hours") + hour<-(unclass(x1$date)-unclass(x2$date))/3600 + if (units=="days") + hour<-(unclass(x1$date)-unclass(x2$date))/(3600*24) + disx<-(x1$x-x2$x) + disy<-(x1$y-x2$y) + so<-cbind.data.frame(id=x2$id,x=x2$x, y=x2$y, date=x2$date, + burst=x2$burst, + sp.x=disx/hour, sp.y=disy/hour, + speed=dist/hour, dt=hour) + return(so) + } + lo<-do.call("rbind", lapply(li, foo)) + row.names(lo)<-1:nrow(lo) + return(lo) + } + diff --git a/data/puechcirc.rda b/data/puechcirc.rda index 3c3edf43943f833ca2e4555b41f4706341f64a74..9a40d666c82964072fae0a85155803b7a77dcf00 100755 GIT binary patch literal 9207 zcmZwMRZtv2w) ztN;BwkLTrdHF*>g)PEN0Mi!zv-gpNj%Ot`=0uNpsP6eBguHX1r6dJcY0y{cWoIp=wwc@U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sO7tgtUWov%-0u1}2b{@Sa3EQ~PKFA3S#d zn%8^}wn*}Xkwh6{_Ci#b^rGI^X`bpvVe4X3UqISDV~#WXoZj%Hq+8nbntICNd@ONe z3|e!{DU2|L*WZk3y8U1kHiNo7!!^6C|E%xEdKg^+Yw8sado8@mG{8^7sqIBmu6nt| zgC!c{cZJ+T3}jXrxsi`n944bIr>-VmS+a9#mN_MhA(9nZprwDR}F5+mgp+(4PHm&_4~YJ}E7@$dJwP{|5u$L_vJk93dw z@ndgKNBB1HZn6D0_F#+6pI>QvI@P!N|FwcJ2JqHFPi~%X8r;=mTVHailLk!sVcjrc1Cz5WcCu039V!V6mO4I1&t+l#GoR%;E G@V@{&UY`yC diff --git a/data/squirreloc.rda b/data/squirreloc.rda new file mode 100755 index 0000000000000000000000000000000000000000..55a752762b7ff193357ec912058bc267b682bbc8 GIT binary patch literal 3201 zcmdti=~oi?8VB%}J6XqE%2KZ+PH9>bqgg{nqIfICH4~~)Q_0M7NF}md5TR)rog%c& zePP_wGIAkTWO7eZa>PbWAw$3c6$L>-mfOtS7vudC=J(<`pYQk8bI$La$BMLh-Jef? zAb;%9j^DPWUd6cuM%C__^+EXtHX2?$R*$Q3R3LM@Qmn6AXF!kakC^;BLFvlZ4MAGQ*FRpg0*POgeM z!`XUO%N-Fxsv||nE2>wM`vHlTk(f7BZcGdLkgH;leW0z42NuP{=63}B#-xkEv!*pO zS6^NX`7jx(PHNny#XyT-YLSxk1KSA>XkL^r^^^o_^EuV&v$4|&m2icJ ziK((%1RbBeQ~2T)+e^c}F9lrf!Nvq<5&xz8PU@pU>M1Kgj2)WLw3>dX+P<`Xe=qs^ zOxV?56Nj6I4EgVrN5_dd(ixq)WS4~hRJTuRhHwF?nk|&1C^Ln3-ZFTJu}@5`kV0AF zH%5HQg|Hm|vsoxF1v;?6?75iQNq8V25o%q9)pbCHZ=Tcm+|Qw-+!6-c=;mXf;(%Cd zE4_jw=IDvAoZ6zoIDiIA?Dzx?pQM&S)p4-aDk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XA7p#cpsa+Z++$NnVS9h?C@PU=OzW8aRS`*yhLxU-BB{oQ^n7-U7B| z{~a61e%-g7cCuYP^B%ppR5R`NrudQd-d=C-8V6cCTZIt&tc5Sy7W_ERYoP2h;&4?i z`;VBN=QB_)K*UuwvqRAKf5e)s;IC=HXc`+`HG+6ne(ta0d-f&-z%%Ac+FE$W?4uR4 zQxSkQc*yoZ0K8&sXlvmU1ESTkdk}y%xXZRhf9qGP1jvg0Bk^|`Pqq>ck22mJ+TpNOEmfPcQ zI|4m|_LLur=+CXrwKxdAgzjSJRBb{0?<|J152DS%_bvX2$WnPcP4fv}Yvz6;*dgn@ zKi%208OP${c5?F)#g;e4 zk#Wpod92TnZ8vcTHK5FW(YV`TM`Tp@`rzRh`c4e}_gH#rEZshq&Wxc)#n8Wqp_fF{ zVbOC~@y=kF##HP+a#u;BC(%A7ByJNx7pIxMEF+7r&$k0Ob`JO(T4{4;uF)Wcfi=j@ zH^YRE|3@GloF60gh0yWy>anxANC{=K`Dfk9xl4A=k1e&|_E#-8HadhvMP}!g#Mi|s z@OJ0lVq`;)uZ#?FAKR1sf7A$OzA_%|d<0F=F6_;N%M>%CBfCOb?g2M0xq8T literal 0 HcmV?d00001 diff --git a/man/Extract.ltraj.Rd b/man/Extract.ltraj.Rd index 655b0a2..febbf19 100755 --- a/man/Extract.ltraj.Rd +++ b/man/Extract.ltraj.Rd @@ -1,48 +1,48 @@ -\name{Extract.ltraj} -\alias{Extract.ltraj} -\alias{[.ltraj} -\alias{[<-.ltraj} -\title{Extract or Replace Parts of an Object of Class ltraj} -\description{ - Extract or replace subsets of objects of class \code{ltraj}. -} -\usage{ - x[i, id, burst] - x[i, id, burst] <- value -} -\arguments{ -\item{x}{an object of class \code{ltraj} } -\item{i}{the elements to extract or replace. \code{i} is - \code{numeric}} -\item{id}{a vector indicating the identity of the animals to extract - or replace} -\item{burst}{a vector indicating the identity of the bursts of - relocations to extract or replace} -\item{value}{an object of class \code{ltraj}} -} -\details{ - Objects of class \code{ltraj} contain several bursts of - relocations. This function subsets or replaces these bursts, based - on their indices or on the attributes \code{id} and \code{burst}. -} -\value{ - An object of class \code{ltraj}. -} -\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } -\seealso{ \code{\link{as.ltraj}}, \code{\link{gdltraj}} } -\examples{ - data(puechcirc) - puechcirc - - ## Extract the second and third bursts - (toto <- puechcirc[2:3]) - - ## Extracts all bursts collected on the animal JE - puechcirc[id = "JE93"] - - - ## Replace one burst - (toto[2] <- puechcirc[1:2]) - -} -\keyword{spatial} +\name{Extract.ltraj} +\alias{Extract.ltraj} +\alias{[.ltraj} +\alias{[<-.ltraj} +\title{Extract or Replace Parts of an Object of Class ltraj} +\description{ + Extract or replace subsets of objects of class \code{ltraj}. +} +\usage{ + x[i, id, burst] + x[i, id, burst] <- value +} +\arguments{ +\item{x}{an object of class \code{ltraj} } +\item{i}{the elements to extract or replace. \code{i} is + \code{numeric}} +\item{id}{a vector indicating the identity of the animals to extract + or replace} +\item{burst}{a vector indicating the identity of the bursts of + relocations to extract or replace} +\item{value}{an object of class \code{ltraj}} +} +\details{ + Objects of class \code{ltraj} contain several bursts of + relocations. This function subsets or replaces these bursts, based + on their indices or on the attributes \code{id} and \code{burst}. +} +\value{ + An object of class \code{ltraj}. +} +\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } +\seealso{ \code{\link{as.ltraj}}, \code{\link{gdltraj}} } +\examples{ + data(puechcirc) + puechcirc + + ## Extract the second and third bursts + (toto <- puechcirc[2:3]) + + ## Extracts all bursts collected on the animal JE + puechcirc[id = "JE93"] + + + ## Replace one burst + (toto[2] <- puechcirc[1:2]) + +} +\keyword{spatial} diff --git a/man/angles.Rd b/man/angles.Rd index a728284..9828e15 100755 --- a/man/angles.Rd +++ b/man/angles.Rd @@ -1,95 +1,95 @@ -\name{angles} -\alias{angles} -\title{Compute Turning Angles - Deprecated} -\description{ - \code{angles} computes the turning angles (in radians) between - consecutive moves from an object of class \code{traj}. See examples - for a clearer definition. -} -\usage{ -angles(x, id = levels(x$id), burst = levels(x$burst), - date = NULL, slsp = c("remove", "missing")) -} -\arguments{ - \item{x}{an object of class \code{traj} } - \item{id}{a character vector giving the identity of the animals for which - the angles are to be computed} - \item{burst}{a character vector giving the identity of the circuits for which - the angles are to be computed (see \code{as.traj})} - \item{date}{a vector of class \code{POSIXct} of length 2 (beginning, end) - delimiting the period of interest} - \item{slsp}{a character string. If \code{"remove"}, successive - relocations located at the same place are replaced by a single - relocation, allowing the computation of the angles. If - \code{"missing"}, a missing value is returned for the angles when - successive relocations located at the same place. } -} -\value{ - Returns a data frame with the following components: - \item{id}{the identity of the animal} - \item{x}{the x coordinate of the relocation at which the angle is computed} - \item{y}{the y coordinate of the relocation at which the angle is computed} - \item{date}{a vector of class \code{POSIXct}, giving the date at which - the relocation has been taken} - \item{burst}{the id of the circuit (see \code{help(as.traj)})} - \item{angles}{the turning angles between the successive moves.} -} -\references{ - Turchin, P. (1998) \emph{Quantitative analysis of movement. Measuring - and modeling population redistribution in animals and plants.} - Sunderland, Massachusetts: Sinauer Associates. -} -\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } -\note{ - The function \code{angles} is deprecated. The class \code{ltraj} - computes the turning angles automatically (see \code{as.ltraj}). -} -\seealso{ \code{\link{speed}} for computation of movement speeds, - \code{\link{as.traj}} for additional information about objects of - class \code{traj} } -\examples{ - -\dontrun{ -## loads an object of class "traj" -data(puechcirc) -puechcir <- ltraj2traj(puechcirc) -puechcir - -## Gets a part of the trajectory of the wild boar named -## CH93 and draws it -## Also displays the turning angles -toto <- puechcir[2:5,] -plot(toto$x, toto$y, asp = 1, ylim = c(3158300, 3158550), - pch = 16, - main = "Turning angles between\nthree consecutive moves", - xlab="X", ylab="Y") -lines(toto$x, toto$y) -lines(c(toto$x[2], 700217.6), - c(toto$y[2], 3158310), lty=2) -lines(c(toto$x[3],700289), - c(toto$y[3],3158546), lty=2) -ang1x <- c(700234.8, 700231.9, 700231, 700233.7, 700238.8, 700243.2) -ang1y <- c(3158332, 3158336, 3158341, 3158347, 3158350, 3158350) -ang2x <- c(700283.3, 700278.8, 700275.4, 700272.4, 700271.2, 700271.6, - 700274.7) -ang2y <- c(3158522, 3158522, 3158520, 3158517, 3158514, 3158508, 3158504) -lines(ang1x, ang1y) -lines(ang2x, ang2y) -text(700216.1, 3158349, expression(theta[1]), cex=2) -text(700247.7, 3158531, expression(theta[2]), cex=2) -text(c(700301, 700231), c(3158399, 3158487), - c("Beginning", "End"), pos=4) - - - -## Computation of the turning angles with real data -## on wild boars -plot(puechcir) -ang <- angles(puechcir) - -## The angles are in the column Angles: -ang[1:4,] -} - -} -\keyword{spatial} +\name{angles} +\alias{angles} +\title{Compute Turning Angles - Deprecated} +\description{ + \code{angles} computes the turning angles (in radians) between + consecutive moves from an object of class \code{traj}. See examples + for a clearer definition. +} +\usage{ +angles(x, id = levels(x$id), burst = levels(x$burst), + date = NULL, slsp = c("remove", "missing")) +} +\arguments{ + \item{x}{an object of class \code{traj} } + \item{id}{a character vector giving the identity of the animals for which + the angles are to be computed} + \item{burst}{a character vector giving the identity of the circuits for which + the angles are to be computed (see \code{as.traj})} + \item{date}{a vector of class \code{POSIXct} of length 2 (beginning, end) + delimiting the period of interest} + \item{slsp}{a character string. If \code{"remove"}, successive + relocations located at the same place are replaced by a single + relocation, allowing the computation of the angles. If + \code{"missing"}, a missing value is returned for the angles when + successive relocations located at the same place. } +} +\value{ + Returns a data frame with the following components: + \item{id}{the identity of the animal} + \item{x}{the x coordinate of the relocation at which the angle is computed} + \item{y}{the y coordinate of the relocation at which the angle is computed} + \item{date}{a vector of class \code{POSIXct}, giving the date at which + the relocation has been taken} + \item{burst}{the id of the circuit (see \code{help(as.traj)})} + \item{angles}{the turning angles between the successive moves.} +} +\references{ + Turchin, P. (1998) \emph{Quantitative analysis of movement. Measuring + and modeling population redistribution in animals and plants.} + Sunderland, Massachusetts: Sinauer Associates. +} +\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } +\note{ + The function \code{angles} is deprecated. The class \code{ltraj} + computes the turning angles automatically (see \code{as.ltraj}). +} +\seealso{ \code{\link{speed}} for computation of movement speeds, + \code{\link{as.traj}} for additional information about objects of + class \code{traj} } +\examples{ + +\dontrun{ +## loads an object of class "traj" +data(puechcirc) +puechcir <- ltraj2traj(puechcirc) +puechcir + +## Gets a part of the trajectory of the wild boar named +## CH93 and draws it +## Also displays the turning angles +toto <- puechcir[2:5,] +plot(toto$x, toto$y, asp = 1, ylim = c(3158300, 3158550), + pch = 16, + main = "Turning angles between\nthree consecutive moves", + xlab="X", ylab="Y") +lines(toto$x, toto$y) +lines(c(toto$x[2], 700217.6), + c(toto$y[2], 3158310), lty=2) +lines(c(toto$x[3],700289), + c(toto$y[3],3158546), lty=2) +ang1x <- c(700234.8, 700231.9, 700231, 700233.7, 700238.8, 700243.2) +ang1y <- c(3158332, 3158336, 3158341, 3158347, 3158350, 3158350) +ang2x <- c(700283.3, 700278.8, 700275.4, 700272.4, 700271.2, 700271.6, + 700274.7) +ang2y <- c(3158522, 3158522, 3158520, 3158517, 3158514, 3158508, 3158504) +lines(ang1x, ang1y) +lines(ang2x, ang2y) +text(700216.1, 3158349, expression(theta[1]), cex=2) +text(700247.7, 3158531, expression(theta[2]), cex=2) +text(c(700301, 700231), c(3158399, 3158487), + c("Beginning", "End"), pos=4) + + + +## Computation of the turning angles with real data +## on wild boars +plot(puechcir) +ang <- angles(puechcir) + +## The angles are in the column Angles: +ang[1:4,] +} + +} +\keyword{spatial} diff --git a/man/as.ltraj.Rd b/man/as.ltraj.Rd index 5298f89..e3b7db1 100755 --- a/man/as.ltraj.Rd +++ b/man/as.ltraj.Rd @@ -1,141 +1,180 @@ -\name{as.ltraj} -\alias{as.ltraj} -\alias{ltraj} -\alias{print.ltraj} -\alias{summary.ltraj} -\alias{traj2ltraj} -\alias{ltraj2traj} -\title{Working with Trajectories in 2D Space: the Class ltraj} -\description{ - The class \code{ltraj} is intended to store trajectories of - animals monitored using radio-tracking.\cr - \code{as.ltraj} creates an object of this class.\cr - \code{summary.ltraj} returns the number of relocations for each "burst" - of relocations and each animal.\cr - \code{traj2ltraj}, and the reciprocal function \code{ltraj2traj} - respectively converts an object of class \code{ltraj} to an object of - class \code{traj}, and conversely. -} -\usage{ -as.ltraj(xy, date, id, burst = id, slsp = c("remove", "missing")) -print.ltraj(x, \dots) -summary.ltraj(object, \dots) -traj2ltraj(traj, slsp = c("remove", "missing")) -ltraj2traj(x) -} -\arguments{ - \item{x, object}{an object of class \code{ltraj}} - \item{xy}{a data.frame containing the x and y coordinates of the - relocations} - \item{date}{a vector of class \code{POSIXct} giving the date for - each relocation} - \item{id}{a character string indicating the identity of the animal} - \item{burst}{a character string indicating the identity of the burst - of relocations} - \item{slsp}{a character string used for the computation of the - turning angles (see details)} - \item{traj}{an object of class \code{traj}} - \item{\dots}{For other functions, arguments to be passed to the generic - functions \code{summary} and \code{print}} -} -\details{ - Objects of class \code{ltraj} allow the analysis of animal - movements. They contain the information generally used in such - studies (angles, length of moves, increases in the x and y - direction, etc., See below).\cr - - For a given individual, trajectories are often sampled as "bursts" - of relocations (Dunn and Gipson, 1977). For example, - when an animal is monitored using radio-tracking, the data may consist - of several circuits of activity (two successive relocations on one - circuit are often highly autocorrelated, but the data from two - circuits may be sampled at long intervals in time). These bursts are - indicated by the attribute \code{burst}. Note that the bursts should - be unique: do not use the same burst id for bursts collected on - different animals.\cr - - The computation of turning angles may be problematic when successive - relocations are located at the same place. In such cases, at least - one missing value is returned. For example, let r1, r2, r3 and r4 be - 4 successive relocations of a given animal (with coordinates (x1,y1), - (x2,y2), etc.). The turning angle in r2 is computed between the moves - r1-r2 and r2-r3. If r2 = r3, then a missing value is returned for the - turning angle at relocation r2. The argument \code{slsp} controls the - value returned for relocation r3 in such cases. If \code{slsp == - "missing"}, a missing value is returned also for the relocation r3. - If \code{slsp == "remove"}, the turning angle computed in r3 is the - angle between the moves r1-r2 and r3-r4.\cr -} -\value{ - \code{summary.ltraj} returns a data frame.\cr - \code{ltraj2traj} returns an object of class \code{traj}.\cr - All other functions return objects of class \code{ltraj}. An object - of class \code{ltraj} is a list with one component per burst of - relocations. Each component is a data frame with two attributes: - the attribute \code{"id"} indicates the identity of the animal, and - the attribute \code{"burst"} indicates the identity of the - burst. Each data frame stores the following columns: -\item{x}{the x coordinate for each relocation} -\item{y}{the y coordinate for each relocation} -\item{date}{the date for each relocation} -\item{dx}{the increase of the move in the x direction} -\item{dy}{the increase of the move in the y direction} -\item{dist}{the length of each move} -\item{dt}{the time interval between successive relocations} -\item{R2n}{the squared net displacement between the current relocation - and the first relocation of the trajectory} -\item{abs.angle}{the angle between each move and the x axis} -\item{rel.angle}{the turning angles between successive moves.} -} -\references{ - Dunn, J.E. and Gipson, P.S. (1977) Analysis of radio telemetry data in - studies of home range. \emph{Biometrics}. \bold{59}, 794--800. -} -\author{ - Clément Calenge \email{calenge@biomserv.univ-lyon1.fr}\cr - Stéphane Dray \email{dray@biomserv.univ-lyon1.fr} -} -\note{ - The class \code{ltraj} is a better alternative to the class - \code{traj}. Indeed, the class \code{ltraj} already contains the - basic information needed for the modelling of movement processes. In - a close future, many functions will be added to adehabitat, allowing - such a modelling.\cr - - Furthermore, note that the computation of the - turning angles is faster with \code{as.ltraj} than with - \code{angles}. -} -\seealso{ \code{\link{c.ltraj}} to combine several objects of class - \code{ltraj}, \code{\link{Extract.ltraj}} to extract or replace - bursts of relocations, \code{\link{plot.ltraj}} for graphical - displays, \code{\link{gdltraj}} to specify a time period. For further - information on the class \code{traj}, see \code{\link{as.traj}}. } -\examples{ - -data(puechabon) -locs <- puechabon$locs -locs[1:4,] -lixy <- split(locs[,c("X","Y")],locs$Name) - -### Conversion of the date to the format POSIX -da <- as.character(locs$Date) -da <- as.POSIXct(strptime(as.character(locs$Date),"\%y\%m\%d")) -lidat <- split(da,locs$Name) - - -### Creation of an object of class "ltraj", with for -### example the first animal -(tr1 <- as.ltraj(lixy[[1]], date = lidat[[1]], id="Brock")) - -## The components of the object of class "ltraj" -head(tr1[[1]]) - -## With all animals -litr <- lapply(1:4, function(i) as.ltraj(lixy[[i]], - date = lidat[[i]], id = names(lidat)[i])) - -(tr <- do.call("c.ltraj", litr)) - -} -\keyword{spatial} +\name{as.ltraj} +\alias{as.ltraj} +\alias{ltraj} +\alias{print.ltraj} +\alias{summary.ltraj} +\alias{traj2ltraj} +\alias{ltraj2traj} +\alias{rec} +\title{Working with Trajectories in 2D Space: the Class ltraj} +\description{ + The class \code{ltraj} is intended to store trajectories of + animals monitored using telemetry (radio-tracking, GPS, Argos).\cr + \code{as.ltraj} creates an object of this class.\cr + \code{summary.ltraj} returns the number of relocations (and missing + values) for each "burst" of relocations and each animal.\cr + \code{traj2ltraj}, and the reciprocal function \code{ltraj2traj} + respectively converts an object of class \code{ltraj} to an object of + class \code{traj}, and conversely. + \code{rec} recalculates the descriptive parameters of an object of + class ltraj (e.g. after a modification of the contents of this object, + see examples) +} +\usage{ +as.ltraj(xy, date, id, burst = id, slsp = c("remove", "missing")) +print.ltraj(x, \dots) +summary.ltraj(object, \dots) +traj2ltraj(traj, slsp = c("remove", "missing")) +ltraj2traj(x) +rec(x, slsp = c("remove", "missing")) +} +\arguments{ + \item{x, object}{an object of class \code{ltraj}} + \item{xy}{a data.frame containing the x and y coordinates of the + relocations} + \item{date}{a vector of class \code{POSIXct} giving the date for + each relocation} + \item{id}{either a character string indicating the identity of the + animal or a factor with length equal to \code{nrow(xy)} } + \item{burst}{either a character string indicating the identity of the + burst of relocations or a factor with length equal to + \code{nrow(xy)}} + \item{slsp}{a character string used for the computation of the + turning angles (see details)} + \item{traj}{an object of class \code{traj}} + \item{\dots}{For other functions, arguments to be passed to the generic + functions \code{summary} and \code{print}} +} +\details{ + Objects of class \code{ltraj} allow the analysis of animal + movements. They contain the information generally used in such + studies (angles, length of moves, increases in the x and y + direction, etc., See below).\cr + + For a given individual, trajectories are often sampled as "bursts" + of relocations (Dunn and Gipson, 1977). For example, + when an animal is monitored using radio-tracking, the data may consist + of several circuits of activity (two successive relocations on one + circuit are often highly autocorrelated, but the data from two + circuits may be sampled at long intervals in time). These bursts are + indicated by the attribute \code{burst}. Note that the bursts should + be unique: do not use the same burst id for bursts collected on + different animals.\cr + + The computation of turning angles may be problematic when successive + relocations are located at the same place. In such cases, at least + one missing value is returned. For example, let r1, r2, r3 and r4 be + 4 successive relocations of a given animal (with coordinates (x1,y1), + (x2,y2), etc.). The turning angle in r2 is computed between the moves + r1-r2 and r2-r3. If r2 = r3, then a missing value is returned for the + turning angle at relocation r2. The argument \code{slsp} controls the + value returned for relocation r3 in such cases. If \code{slsp == + "missing"}, a missing value is returned also for the relocation r3. + If \code{slsp == "remove"}, the turning angle computed in r3 is the + angle between the moves r1-r2 and r3-r4.\cr + + In theory, it is expected that the time lag between two relocations is + constant in all the bursts and all the ids of one object of class + \code{ltraj} (don't mix animals located every 10 minutes and animals + located every day in the same object). Nevertheless, This class allows + for some negligible imprecision in the time of collection of the data + (which may occur with some modes of data collection, e.g. with Argos + collars).\cr + + Missing values are frequent in the trajectories of animals collected + using telemetry, and are therefore allowed in objects of class + \code{ltraj}. For example, GPS collar may not receive the + signal of the satellite at the time of relocation. Most functions + dealing with the class \code{ltraj} have a specified behavior in case of + missing values. +} +\value{ + \code{summary.ltraj} returns a data frame.\cr + \code{ltraj2traj} returns an object of class \code{traj}.\cr + All other functions return objects of class \code{ltraj}. An object + of class \code{ltraj} is a list with one component per burst of + relocations. Each component is a data frame with two attributes: + the attribute \code{"id"} indicates the identity of the animal, and + the attribute \code{"burst"} indicates the identity of the + burst. Each data frame stores the following columns: +\item{x}{the x coordinate for each relocation} +\item{y}{the y coordinate for each relocation} +\item{date}{the date for each relocation} +\item{dx}{the increase of the move in the x direction. At least two + successive relocations are needed to compute \code{dx}. Missing + values are returned otherwise.} +\item{dy}{the increase of the move in the y direction. At least two + successive relocations are needed to compute \code{dy}. Missing + values are returned otherwise.} +\item{dist}{the length of each move. At least two + successive relocations are needed to compute \code{dist}. Missing + values are returned otherwise.} +\item{dt}{the time interval between successive relocations} +\item{R2n}{the squared net displacement between the current relocation + and the first relocation of the trajectory} +\item{abs.angle}{the angle between each move and the x axis. At least two + successive relocations are needed to compute \code{abs.angle}. Missing + values are returned otherwise.} +\item{rel.angle}{the turning angles between successive moves. At least + three successive relocations are needed to compute \code{rel.angle}. + Missing values are returned otherwise.} +} +\references{ + Dunn, J.E. and Gipson, P.S. (1977) Analysis of radio telemetry data in + studies of home range. \emph{Biometrics}. \bold{59}, 794--800. +} +\author{ + Clément Calenge \email{calenge@biomserv.univ-lyon1.fr}\cr + Stéphane Dray \email{dray@biomserv.univ-lyon1.fr} +} +\note{ + The class \code{ltraj} is a better alternative to the class + \code{traj}. Indeed, the class \code{ltraj} already contains the + basic information needed for the modelling of movement processes. In + a close future, many functions will be added to adehabitat, allowing + such a modelling.\cr + + Furthermore, note that the computation of the + turning angles is faster with \code{as.ltraj} than with + \code{angles}. +} +\seealso{ \code{\link{c.ltraj}} to combine several objects of class + \code{ltraj}, \code{\link{Extract.ltraj}} to extract or replace + bursts of relocations, \code{\link{plot.ltraj}} for graphical + displays, \code{\link{gdltraj}} to specify a time period. For further + information on the class \code{traj}, see \code{\link{as.traj}}. } +\examples{ + +data(puechabon) +locs <- puechabon$locs +locs[1:4,] +xy <- locs[,c("X","Y")] + +### Conversion of the date to the format POSIX +da <- as.character(locs$Date) +da <- as.POSIXct(strptime(as.character(locs$Date),"\%y\%m\%d")) + + +### Creation of an object of class "ltraj", with for +### example the first animal +(tr1 <- as.ltraj(xy[locs$Name=="Brock",], + date = da[locs$Name=="Brock"], + id="Brock")) + +## The components of the object of class "ltraj" +head(tr1[[1]]) + +## With all animals +(litr <- as.ltraj(xy, da, id = locs$Name)) + +## Change something Manually in the first burst: +head(litr[[1]]) +litr[[1]][3,"x"] <- 700000 + +## Recompute the trajectory +litr <- rec(litr) +## Note that descriptive statistics have changed (e.g. dx) +head(litr[[1]]) + +} +\keyword{spatial} diff --git a/man/as.traj.Rd b/man/as.traj.Rd index 8e2f09d..01115c4 100755 --- a/man/as.traj.Rd +++ b/man/as.traj.Rd @@ -1,138 +1,138 @@ -\name{as.traj} -\alias{as.traj} -\alias{traj} -\alias{print.traj} -\alias{summary.traj} -\alias{plot.traj} -\alias{getburst} -\alias{traj2df} -\alias{df2traj} -\title{Working with Trajectories in 2D Space - Deprecated} -\description{ - The class \code{traj} is intended to explore trajectories of - animals monitored using radio-tracking.\cr - \code{as.traj} creates an object of this class.\cr - \code{summary.traj} returns the number of relocations for each "burst" - of relocations and each animal.\cr - \code{plot.traj} allows various graphical displays of the - trajectories.\cr - \code{getburst} returns an object of class \code{traj} satisfying the - specified criteria (selection of one focus animal, of a period of interest, - of special "bursts" (see details)).\cr - \code{traj2df}, and the reciprocal function \code{df2traj} - respectively converts an object of class \code{traj} to an object of - class \code{data.frame}, and conversely. -} -\usage{ -as.traj(id, xy, date, burst = id, ...) -print.traj(x, ...) -summary.traj(object, id = levels(object$id), date = NULL, \dots) -plot.traj(x, id = levels(x$id), burst = levels(x$burst), date = NULL, - asc = NULL, area = NULL, - xlim = range(x$x), ylim = range(x$y), - colasc = gray((256:1)/256), colpol = "green", - addpoints = TRUE, addlines = TRUE, - perani = TRUE, final = TRUE, \dots) -getburst(x, burst = levels(x$burst), - id = levels(x$id), date = NULL) -traj2df(x) -df2traj(df) -} -\arguments{ - \item{id}{a factor giving for each relocation the - identity of the individual monitored in \code{as.traj}. \cr - a character vector containing the identity of the - individuals of interest in other functions} - \item{xy}{a data frame containing the coordinates of the relocations} - \item{date}{a vector of class \code{POSIXct} - giving the date for each relocation in \code{as.traj}.\cr - a vector of class \code{POSIXct} with length 2, indicating the - beginning and the end of the period of interest in other - functions} - \item{burst}{a factor giving the identity of each - "burst" of relocations in \code{as.traj} (e.g. the circuit id, see - details). The burst level needs to be unique (two animals cannot - have the same burst levels). \cr - a character vector containing the burst levels of interest in - \code{plot.traj} and \code{getburst}} - \item{x}{an object of class \code{traj}} - \item{object}{an object of class \code{traj}} - \item{asc}{an object of class \code{asc}} - \item{area}{an object of class \code{area} (see \code{help(area)})} - \item{xlim}{the ranges to be encompassed by the x axis} - \item{ylim}{the ranges to be encompassed by the y axis} - \item{colasc}{a character vector giving the colors of the - map of class \code{asc}} - \item{colpol}{a character vector giving the colors of the - polygon contour map, when \code{area} is not \code{NULL}} - \item{addlines}{logical. If \code{TRUE}, lines joining consecutive - relocations are drawn} - \item{addpoints}{logical. If \code{TRUE}, points corresponding to - each relocation are drawn} - \item{perani}{logical. If \code{TRUE}, one plot is drawn for each - level of the factor \code{id}, and for a given animal, the several - bursts are superposed on the same plot. If \code{FALSE}, one plot - is drawn for each level of the factor \code{burst}} - \item{final}{logical. If \code{TRUE}, the initial and final - relocations of each burst are indicated in blue and red, respectively} - \item{df}{a data frame to be converted to the class \code{traj}} - \item{\dots}{other optional vectors containing some variables measured at - each relocation (e.g. temperature, wind, - elevation, etc.) in \code{as.traj}. \cr - For other functions, arguments to be passed to - the generic functions \code{plot}, \code{summary} and \code{print}} -} -\details{ - For a given individual, trajectories are often sampled as "bursts" - of relocations (Dunn and Gipson, 1977). For example, - when an animal is monitored using radio-tracking, the data may consist - of several circuits of activity (two successive relocations on one - circuit are often highly autocorrelated, but the data from two - circuits may be sampled at long intervals in time). These bursts are - indicated by the factor \code{burst}. -} -\value{ - An object of class \code{traj} is a data frame with one column - named \code{id}, one column named \code{x}, one column named \code{y}, - one column named \code{date} and one column named \code{burst}. This - class therefore inherits from the class \code{data.frame}. -} -\references{ - Dunn, J.E. and Gipson, P.S. (1977) Analysis of radio telemetry data in - studies of home range. \emph{Biometrics}. \bold{59}, 794--800. -} -\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } -\note{ - The class \code{traj} is deprecated. Please rather use the class - \code{ltraj}. -} -\seealso{ \code{\link{as.POSIXct}} and \code{\link{strptime}} for - additional information of the class \code{POSIX}. } -\examples{ - -\dontrun{ -data(puechabon) -locs <- puechabon$locs -locs[1:4,] - -### Conversion of the date to the format POSIX -da <- as.character(locs$Date) -da <- as.POSIXct(strptime(as.character(locs$Date), - "\%y\%m\%d")) - - -### Creation of the object of class "traj" -(tr <- as.traj(id = locs$Name, xy = locs[,c("X", "Y")], - date = da)) -summary(tr) -plot(tr) - -### Displays on maps of the study area -k <- puechabon$kasc -ele <- getkasc(k, "Elevation") -plot(tr, asc = ele) -} - - -} -\keyword{spatial} +\name{as.traj} +\alias{as.traj} +\alias{traj} +\alias{print.traj} +\alias{summary.traj} +\alias{plot.traj} +\alias{getburst} +\alias{traj2df} +\alias{df2traj} +\title{Working with Trajectories in 2D Space - Deprecated} +\description{ + The class \code{traj} is intended to explore trajectories of + animals monitored using radio-tracking.\cr + \code{as.traj} creates an object of this class.\cr + \code{summary.traj} returns the number of relocations for each "burst" + of relocations and each animal.\cr + \code{plot.traj} allows various graphical displays of the + trajectories.\cr + \code{getburst} returns an object of class \code{traj} satisfying the + specified criteria (selection of one focus animal, of a period of interest, + of special "bursts" (see details)).\cr + \code{traj2df}, and the reciprocal function \code{df2traj} + respectively converts an object of class \code{traj} to an object of + class \code{data.frame}, and conversely. +} +\usage{ +as.traj(id, xy, date, burst = id, ...) +print.traj(x, ...) +summary.traj(object, id = levels(object$id), date = NULL, \dots) +plot.traj(x, id = levels(x$id), burst = levels(x$burst), date = NULL, + asc = NULL, area = NULL, + xlim = range(x$x), ylim = range(x$y), + colasc = gray((256:1)/256), colpol = "green", + addpoints = TRUE, addlines = TRUE, + perani = TRUE, final = TRUE, \dots) +getburst(x, burst = levels(x$burst), + id = levels(x$id), date = NULL) +traj2df(x) +df2traj(df) +} +\arguments{ + \item{id}{a factor giving for each relocation the + identity of the individual monitored in \code{as.traj}. \cr + a character vector containing the identity of the + individuals of interest in other functions} + \item{xy}{a data frame containing the coordinates of the relocations} + \item{date}{a vector of class \code{POSIXct} + giving the date for each relocation in \code{as.traj}.\cr + a vector of class \code{POSIXct} with length 2, indicating the + beginning and the end of the period of interest in other + functions} + \item{burst}{a factor giving the identity of each + "burst" of relocations in \code{as.traj} (e.g. the circuit id, see + details). The burst level needs to be unique (two animals cannot + have the same burst levels). \cr + a character vector containing the burst levels of interest in + \code{plot.traj} and \code{getburst}} + \item{x}{an object of class \code{traj}} + \item{object}{an object of class \code{traj}} + \item{asc}{an object of class \code{asc}} + \item{area}{an object of class \code{area} (see \code{help(area)})} + \item{xlim}{the ranges to be encompassed by the x axis} + \item{ylim}{the ranges to be encompassed by the y axis} + \item{colasc}{a character vector giving the colors of the + map of class \code{asc}} + \item{colpol}{a character vector giving the colors of the + polygon contour map, when \code{area} is not \code{NULL}} + \item{addlines}{logical. If \code{TRUE}, lines joining consecutive + relocations are drawn} + \item{addpoints}{logical. If \code{TRUE}, points corresponding to + each relocation are drawn} + \item{perani}{logical. If \code{TRUE}, one plot is drawn for each + level of the factor \code{id}, and for a given animal, the several + bursts are superposed on the same plot. If \code{FALSE}, one plot + is drawn for each level of the factor \code{burst}} + \item{final}{logical. If \code{TRUE}, the initial and final + relocations of each burst are indicated in blue and red, respectively} + \item{df}{a data frame to be converted to the class \code{traj}} + \item{\dots}{other optional vectors containing some variables measured at + each relocation (e.g. temperature, wind, + elevation, etc.) in \code{as.traj}. \cr + For other functions, arguments to be passed to + the generic functions \code{plot}, \code{summary} and \code{print}} +} +\details{ + For a given individual, trajectories are often sampled as "bursts" + of relocations (Dunn and Gipson, 1977). For example, + when an animal is monitored using radio-tracking, the data may consist + of several circuits of activity (two successive relocations on one + circuit are often highly autocorrelated, but the data from two + circuits may be sampled at long intervals in time). These bursts are + indicated by the factor \code{burst}. +} +\value{ + An object of class \code{traj} is a data frame with one column + named \code{id}, one column named \code{x}, one column named \code{y}, + one column named \code{date} and one column named \code{burst}. This + class therefore inherits from the class \code{data.frame}. +} +\references{ + Dunn, J.E. and Gipson, P.S. (1977) Analysis of radio telemetry data in + studies of home range. \emph{Biometrics}. \bold{59}, 794--800. +} +\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } +\note{ + The class \code{traj} is deprecated. Please rather use the class + \code{ltraj}. +} +\seealso{ \code{\link{as.POSIXct}} and \code{\link{strptime}} for + additional information of the class \code{POSIX}. } +\examples{ + +\dontrun{ +data(puechabon) +locs <- puechabon$locs +locs[1:4,] + +### Conversion of the date to the format POSIX +da <- as.character(locs$Date) +da <- as.POSIXct(strptime(as.character(locs$Date), + "\%y\%m\%d")) + + +### Creation of the object of class "traj" +(tr <- as.traj(id = locs$Name, xy = locs[,c("X", "Y")], + date = da)) +summary(tr) +plot(tr) + +### Displays on maps of the study area +k <- puechabon$kasc +ele <- getkasc(k, "Elevation") +plot(tr, asc = ele) +} + + +} +\keyword{spatial} diff --git a/man/buffer.Rd b/man/buffer.Rd index 5b7a0f0..a318f91 100755 --- a/man/buffer.Rd +++ b/man/buffer.Rd @@ -1,77 +1,77 @@ -\name{buffer} -\alias{buffer} -\alias{buffer.ani} -\alias{buffer.line} -\title{Compute Buffers} -\description{ - \code{buffer} compute buffers around a set of - locations. \cr - \code{buffer.ani} is to be used when the - points can be grouped into several categories (e.g. the relocations - of several animals monitored using radio-tracking; the function - \code{buffer} is then applied to each animal).\cr - \code{buffer.line} compute buffers around a line. -} -\usage{ -buffer(pts, x, dist) -buffer.ani(pts, fac, x, dist) -buffer.line(xy, x, dist) -} - -\arguments{ - \item{pts}{a data frame with two columns (x and y coordinates of the - points)} - \item{x}{either an object of class \code{asc} or \code{kasc} with the same - attributes as those desired for the output, or an object of class - \code{mapattr} (see \code{storemapattr})} - \item{dist}{a value of distance} - \item{fac}{a factor defining the categories of the points} - \item{xy}{a data frame containing the coordinates of the vertices of - the lines} -} -\value{ - \code{buffer} and \code{buffer.line} return an object of class - \code{asc}, with 1 for pixels - located within a specified distance of given points, and \code{NA} - otherwise.\cr - \code{buffer.ani} returns a data frame of class \code{kasc}, - with each column corresponding to one level of the factor \code{fac}. -} -\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } - -\seealso{ \code{\link{as.kasc}} for additionnal information on - objects of class \code{kasc}, \code{\link{import.asc}} for further - information on objects of class \code{asc}, \code{\link{storemapattr}} - for further information on objects of class \code{mapattr}. -} - -\examples{ -data(puechabon) - -# locs is the data frame containing the -# relocations of wild boars monitored by radio-tracking -locs <- puechabon$locs - -# sa is the "kasc" object of maps of the study area -sa <- puechabon$kasc - -# Buffer of 500 m around all relocations -bu <- buffer(locs[,4:5], sa, 500) -image(bu) - -# displays all the pixels of the study area within 500 m -# of a relocation of each monitored wild boar -buani <- buffer.ani(locs[,4:5], locs[,1], sa, 500) -image(buani) - - -## buffer around a trajectory -data(puechcirc) -uu <- puechcirc[burst = "CH930824"] -w <- ascgen(uu[[1]][,c("x","y")], nrcol = 100) -out <- buffer.line(uu[[1]][,c("x","y")], w, 100) -image(out) -plot(uu, asc = out) - -} -\keyword{spatial} +\name{buffer} +\alias{buffer} +\alias{buffer.ani} +\alias{buffer.line} +\title{Compute Buffers} +\description{ + \code{buffer} compute buffers around a set of + locations. \cr + \code{buffer.ani} is to be used when the + points can be grouped into several categories (e.g. the relocations + of several animals monitored using radio-tracking; the function + \code{buffer} is then applied to each animal).\cr + \code{buffer.line} compute buffers around a line. +} +\usage{ +buffer(pts, x, dist) +buffer.ani(pts, fac, x, dist) +buffer.line(xy, x, dist) +} + +\arguments{ + \item{pts}{a data frame with two columns (x and y coordinates of the + points)} + \item{x}{either an object of class \code{asc} or \code{kasc} with the same + attributes as those desired for the output, or an object of class + \code{mapattr} (see \code{storemapattr})} + \item{dist}{a value of distance} + \item{fac}{a factor defining the categories of the points} + \item{xy}{a data frame containing the coordinates of the vertices of + the lines} +} +\value{ + \code{buffer} and \code{buffer.line} return an object of class + \code{asc}, with 1 for pixels + located within a specified distance of given points, and \code{NA} + otherwise.\cr + \code{buffer.ani} returns a data frame of class \code{kasc}, + with each column corresponding to one level of the factor \code{fac}. +} +\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } + +\seealso{ \code{\link{as.kasc}} for additionnal information on + objects of class \code{kasc}, \code{\link{import.asc}} for further + information on objects of class \code{asc}, \code{\link{storemapattr}} + for further information on objects of class \code{mapattr}. +} + +\examples{ +data(puechabon) + +# locs is the data frame containing the +# relocations of wild boars monitored by radio-tracking +locs <- puechabon$locs + +# sa is the "kasc" object of maps of the study area +sa <- puechabon$kasc + +# Buffer of 500 m around all relocations +bu <- buffer(locs[,4:5], sa, 500) +image(bu) + +# displays all the pixels of the study area within 500 m +# of a relocation of each monitored wild boar +buani <- buffer.ani(locs[,4:5], locs[,1], sa, 500) +image(buani) + + +## buffer around a trajectory +data(puechcirc) +uu <- puechcirc[burst = "CH930824"] +w <- ascgen(uu[[1]][,c("x","y")], nrcol = 100) +out <- buffer.line(uu[[1]][,c("x","y")], w, 100) +image(out) +plot(uu, asc = out) + +} +\keyword{spatial} diff --git a/man/c.ltraj.Rd b/man/c.ltraj.Rd index ecc91f8..b3f3c13 100755 --- a/man/c.ltraj.Rd +++ b/man/c.ltraj.Rd @@ -1,33 +1,33 @@ -\name{c.ltraj} -\alias{c.ltraj} -\title{Combine Bursts of Relocations in Objects of Class "ltraj"} -\description{ - This function combines several objects of class \code{ltraj}. -} -\usage{ -c.ltraj(...) -} -\arguments{ - \item{\dots}{objects of class \code{ltraj} to be combined} -} -\value{ - An object of class \code{ltraj}. -} -\author{ - Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} -} -\seealso{\code{\link{as.ltraj}} for further information on the class - \code{ltraj}, \code{\link{Extract.ltraj}} to extract or replace - bursts of relocations, \code{\link{plot.ltraj}} for graphical - displays, \code{\link{gdltraj}} to specify a time period} -\examples{ - -data(puechcirc) - -(i <- puechcirc[1]) -(j <- puechcirc[4]) - -(toto <- c(i,j)) - -} -\keyword{spatial} +\name{c.ltraj} +\alias{c.ltraj} +\title{Combine Bursts of Relocations in Objects of Class "ltraj"} +\description{ + This function combines several objects of class \code{ltraj}. +} +\usage{ +c.ltraj(...) +} +\arguments{ + \item{\dots}{objects of class \code{ltraj} to be combined} +} +\value{ + An object of class \code{ltraj}. +} +\author{ + Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} +} +\seealso{\code{\link{as.ltraj}} for further information on the class + \code{ltraj}, \code{\link{Extract.ltraj}} to extract or replace + bursts of relocations, \code{\link{plot.ltraj}} for graphical + displays, \code{\link{gdltraj}} to specify a time period} +\examples{ + +data(puechcirc) + +(i <- puechcirc[1]) +(j <- puechcirc[4]) + +(toto <- c(i,j)) + +} +\keyword{spatial} diff --git a/man/compana.Rd b/man/compana.Rd index 90b7128..e704946 100755 --- a/man/compana.Rd +++ b/man/compana.Rd @@ -1,179 +1,179 @@ -\name{compana} -\alias{compana} -\alias{print.compana} -\title{Compositional Analysis of Habitat Use} -\description{ -\code{compana} performs a classical compositional analysis of habitat -use (Aebischer et al., 1993). -} -\usage{ -compana(used, avail, test = c("randomisation", "parametric"), - rnv = 0.01, nrep = 500, alpha = 0.1) -} -\arguments{ - \item{used}{a matrix or a data frame giving the percentage of use - of habitats (in columns) by animals (in rows). } - \item{avail}{a matrix or a data frame describing the percentage of - availability of habitats (in columns) by animals (in rows). } - \item{test}{a character string. If \code{"randomisation"}, - randomisation tests are performed for - both the habitat ranking and - the test of habitat selection. - If \code{"parametric"}, usual - parametric tests are performed (chi-square for the test of habitat - selection and t-tests for habitat ranking).} - \item{rnv}{the number replacing the 0 values occurring in the - matrix \code{used}. } - \item{nrep}{the number of repetitions in the - randomisation tests. } - \item{alpha}{the alpha level for the tests. } -} -\details{ - The compositional analysis of habitat use has been recommended by - Aebischer et al. (1993) for the analysis of habitat selection by - several animals, when the resources are defined by several categories - (e.g. vegetation types).\cr - This analysis is carried out in two steps: first the significance of - habitat selection is tested (using a Wilks lambda). Then, a ranking - matrix is built, indicating whether the habitat type in row is - significantly used more or less than the habitat type in column. - When this analysis is performed on radio-tracking data, Aebischer et - al. recommend to study habitat selection at two scales: (i) selection - of the home range within the study area, and (ii) selection of the - relocations within the home range. The first scale is termed - second-order habitat selection by Johnson (1980), and the second, - third-order habitat selection.\cr - - When zero values are found - in the matrix of used habitats, they are replaced by a small value (by - default, 0.01), according to the recommendations of Aebischer et al. - (1993).\cr - - When zero values are found in the matrix of available habitats, the - function \code{compana} uses the procedure termed - "weighted mean lambda" described in Aebischer et al. - (1993: Appendix 2), instead of the usual lambda (see examples). Zero - values can be found in the matrix of available habitats when the - third-order habitat selection is under focus. In this case, it may - occur that some habitat types are available to some animals and not to - the others. -} -\value{ - Returns a list of the class \code{compana}: - \item{used}{the matrix of used habitats} - \item{avail}{the matrix of available habitats} - \item{type.test}{a character string. Either \code{"randomisation"} or - \code{"parametric"}} - \item{test}{the results of the test of habitat selection} - \item{rm}{the ranking matrix: a square matrix with \code{nh} rows and - \code{nh} columns, where \code{nh} is the number of habitat types - under study. At the intersection of the row \code{i} and of the - column \code{j}, there is a \code{"+"} when the habitat \code{i} is - more used than the habitat in column, and \code{"-"} otherwise. - When the difference is significant, the sign is tripled.} - \item{rmnb}{the matrix containing the number of animals used to - perform the tests in \code{rm}.} - \item{rank}{the rank of the habitat types. It is equal to the number - of \code{"+"} for each habitat type in row of \code{rm}.} - \item{rmv}{the matrix of statistics used to build \code{rm}. - if \code{(test = "parametric")}, the matrix contains the - values of \code{t}, in the t-test comparing the row and the column - habitat. if \code{(test = "randomisation")}, the matrix contains - the mean difference between the used and available log-ratios (see - Aebischer et al., 1993).} - \item{profile}{The profile of preferences: resource types are sorted - so that the left type is the most preferred and the right type is - the most avoided. Habitats for which the intensity of habitat - selection is similar (no significant difference) are connected by a - line.} -} -\references{ -Aebischer, N. J. and Robertson, P. A. (1992) Practical aspects of -compositional analysis as applied to pheasant habitat -utilisation. pp. 285--293 In: Priede, G. and Swift, S. M. \emph{Wildlife - telemetry, remote monitoring and tracking of animals}. - -Aebischer, N. J., Robertson, P. A. and Kenward, R. E. (1993) -Compositional analysis of habitat use from animal radiotracking -data. \emph{Ecology}, \bold{74}, 1313--1325. - -Johnson, D. H. (1980) The comparison of usage and availability -measurements for evaluating resource preference. \emph{Ecology}, \bold{61}, -65--71. -} -\author{Clément Calenge \email{calenge@biomserv.univ-lyon1.fr}} -\note{ -In the examples below, the results differ from those published in -Aebischer et al. (squirrel example, selection of the relocations within -the home range). In fact, there has been a confusion in the column names -in the paper. Actually, Aebischer (pers. com.) indicated that the -ranking matrix given in this example is correct. -} -\seealso{ \code{\link{wiII}} and \code{\link{wiIII}} - for computation of selection ratios, and \code{\link{eisera}} to perform an - eigenanalysis of selection ratios. } - -\examples{ - -## The examples presented here -## are the same as those presented in -## the paper of Aebischer et al. (1993) - - -############################# -## Pheasant dataset: first -## example in Aebischer et al. - -data(pheasant) - -## Second order habitat selection -## Selection of home range within the -## study area (example of parametric test) -pheana2 <- compana(pheasant$mcp, pheasant$studyarea, - test = "parametric") -pheana2 - -## The ranking matrix: -print(pheana2$rm, quote = FALSE) - -## Third order habitat selection -## (relocation within home range) -## We remove the first pheasant of the analysis -## (as in the paper of Aebischer et al.) -## before the analysis -pheana3 <- compana(pheasant$locs[-1,], pheasant$mcp[-1,c(1,2,4)]) -pheana3 - -## The ranking matrix: -print(pheana3$rm, quote = FALSE) - - - -############################# -## Squirrel data set: second -## example in Aebischer et al. - -data(squirrel) - -## Second order habitat selection -## Selection of home range within the -## study area -squiana2 <- compana(squirrel$mcp, squirrel$studyarea) -squiana2 - -## The ranking matrix: -print(squiana2$rm, quote = FALSE) - -## Third order habitat selection -## (relocation within home range) -## We remove the second column -## (as in the paper of Aebischer et al.) -squiana3 <- compana(squirrel$locs[,-2], squirrel$mcp[,-2]) -squiana3 - -## The ranking matrix: -print(squiana3$rm, quote = FALSE) - - -} -\keyword{math} +\name{compana} +\alias{compana} +\alias{print.compana} +\title{Compositional Analysis of Habitat Use} +\description{ +\code{compana} performs a classical compositional analysis of habitat +use (Aebischer et al., 1993). +} +\usage{ +compana(used, avail, test = c("randomisation", "parametric"), + rnv = 0.01, nrep = 500, alpha = 0.1) +} +\arguments{ + \item{used}{a matrix or a data frame giving the percentage of use + of habitats (in columns) by animals (in rows). } + \item{avail}{a matrix or a data frame describing the percentage of + availability of habitats (in columns) by animals (in rows). } + \item{test}{a character string. If \code{"randomisation"}, + randomisation tests are performed for + both the habitat ranking and + the test of habitat selection. + If \code{"parametric"}, usual + parametric tests are performed (chi-square for the test of habitat + selection and t-tests for habitat ranking).} + \item{rnv}{the number replacing the 0 values occurring in the + matrix \code{used}. } + \item{nrep}{the number of repetitions in the + randomisation tests. } + \item{alpha}{the alpha level for the tests. } +} +\details{ + The compositional analysis of habitat use has been recommended by + Aebischer et al. (1993) for the analysis of habitat selection by + several animals, when the resources are defined by several categories + (e.g. vegetation types).\cr + This analysis is carried out in two steps: first the significance of + habitat selection is tested (using a Wilks lambda). Then, a ranking + matrix is built, indicating whether the habitat type in row is + significantly used more or less than the habitat type in column. + When this analysis is performed on radio-tracking data, Aebischer et + al. recommend to study habitat selection at two scales: (i) selection + of the home range within the study area, and (ii) selection of the + relocations within the home range. The first scale is termed + second-order habitat selection by Johnson (1980), and the second, + third-order habitat selection.\cr + + When zero values are found + in the matrix of used habitats, they are replaced by a small value (by + default, 0.01), according to the recommendations of Aebischer et al. + (1993).\cr + + When zero values are found in the matrix of available habitats, the + function \code{compana} uses the procedure termed + "weighted mean lambda" described in Aebischer et al. + (1993: Appendix 2), instead of the usual lambda (see examples). Zero + values can be found in the matrix of available habitats when the + third-order habitat selection is under focus. In this case, it may + occur that some habitat types are available to some animals and not to + the others. +} +\value{ + Returns a list of the class \code{compana}: + \item{used}{the matrix of used habitats} + \item{avail}{the matrix of available habitats} + \item{type.test}{a character string. Either \code{"randomisation"} or + \code{"parametric"}} + \item{test}{the results of the test of habitat selection} + \item{rm}{the ranking matrix: a square matrix with \code{nh} rows and + \code{nh} columns, where \code{nh} is the number of habitat types + under study. At the intersection of the row \code{i} and of the + column \code{j}, there is a \code{"+"} when the habitat \code{i} is + more used than the habitat in column, and \code{"-"} otherwise. + When the difference is significant, the sign is tripled.} + \item{rmnb}{the matrix containing the number of animals used to + perform the tests in \code{rm}.} + \item{rank}{the rank of the habitat types. It is equal to the number + of \code{"+"} for each habitat type in row of \code{rm}.} + \item{rmv}{the matrix of statistics used to build \code{rm}. + if \code{(test = "parametric")}, the matrix contains the + values of \code{t}, in the t-test comparing the row and the column + habitat. if \code{(test = "randomisation")}, the matrix contains + the mean difference between the used and available log-ratios (see + Aebischer et al., 1993).} + \item{profile}{The profile of preferences: resource types are sorted + so that the left type is the most preferred and the right type is + the most avoided. Habitats for which the intensity of habitat + selection is similar (no significant difference) are connected by a + line.} +} +\references{ +Aebischer, N. J. and Robertson, P. A. (1992) Practical aspects of +compositional analysis as applied to pheasant habitat +utilisation. pp. 285--293 In: Priede, G. and Swift, S. M. \emph{Wildlife + telemetry, remote monitoring and tracking of animals}. + +Aebischer, N. J., Robertson, P. A. and Kenward, R. E. (1993) +Compositional analysis of habitat use from animal radiotracking +data. \emph{Ecology}, \bold{74}, 1313--1325. + +Johnson, D. H. (1980) The comparison of usage and availability +measurements for evaluating resource preference. \emph{Ecology}, \bold{61}, +65--71. +} +\author{Clément Calenge \email{calenge@biomserv.univ-lyon1.fr}} +\note{ +In the examples below, the results differ from those published in +Aebischer et al. (squirrel example, selection of the relocations within +the home range). In fact, there has been a confusion in the column names +in the paper. Actually, Aebischer (pers. com.) indicated that the +ranking matrix given in this example is correct. +} +\seealso{ \code{\link{wiII}} and \code{\link{wiIII}} + for computation of selection ratios, and \code{\link{eisera}} to perform an + eigenanalysis of selection ratios. } + +\examples{ + +## The examples presented here +## are the same as those presented in +## the paper of Aebischer et al. (1993) + + +############################# +## Pheasant dataset: first +## example in Aebischer et al. + +data(pheasant) + +## Second order habitat selection +## Selection of home range within the +## study area (example of parametric test) +pheana2 <- compana(pheasant$mcp, pheasant$studyarea, + test = "parametric") +pheana2 + +## The ranking matrix: +print(pheana2$rm, quote = FALSE) + +## Third order habitat selection +## (relocation within home range) +## We remove the first pheasant of the analysis +## (as in the paper of Aebischer et al.) +## before the analysis +pheana3 <- compana(pheasant$locs[-1,], pheasant$mcp[-1,c(1,2,4)]) +pheana3 + +## The ranking matrix: +print(pheana3$rm, quote = FALSE) + + + +############################# +## Squirrel data set: second +## example in Aebischer et al. + +data(squirrel) + +## Second order habitat selection +## Selection of home range within the +## study area +squiana2 <- compana(squirrel$mcp, squirrel$studyarea) +squiana2 + +## The ranking matrix: +print(squiana2$rm, quote = FALSE) + +## Third order habitat selection +## (relocation within home range) +## We remove the second column +## (as in the paper of Aebischer et al.) +squiana3 <- compana(squirrel$locs[,-2], squirrel$mcp[,-2]) +squiana3 + +## The ranking matrix: +print(squiana3$rm, quote = FALSE) + + +} +\keyword{math} diff --git a/man/eisera.Rd b/man/eisera.Rd index d7fff0b..18d9b40 100755 --- a/man/eisera.Rd +++ b/man/eisera.Rd @@ -1,95 +1,112 @@ -\name{eisera} -\alias{eisera} -\alias{print.esr} -\alias{scatter.esr} -\title{Eigenanalysis of Selection Ratios} -\description{ - Performs an eigenanalysis of selection ratios. -} -\usage{ -eisera(used, available, scannf = TRUE, nf = 2) -print.esr(x, \dots) -scatter.esr(x, xax = 1, yax = 2, - csub = 1, possub = "bottomleft", \dots) -} -\arguments{ - \item{used}{a data frame containing the *number* of relocations of - each animal (rows) in each habitat type (columns) } - \item{available}{a data frame containing the *proportion* of - availability of each habitat type (columns) to each animal (rows)} - \item{scannf}{logical. Whether the eigenvalues bar plot should be - displayed} - \item{nf}{if \code{scannf = FALSE}, an integer indicating the number - of kept axes} - \item{x}{an object of class \code{esr}} - \item{xax}{the column number for the x-axis} - \item{yax}{the column number for the y-axis} - \item{csub}{a character size for the legend, used with - \code{par("cex")*csub}} - \item{possub}{a string of characters indicating the sub-title - position ("topleft", "topright", "bottomleft", - "bottomright")} - \item{\dots}{further arguments passed to or from other methods} -} -\details{ - The eigenanalysis of selection ratios has been developped to explore - habitat selection by animals monitored using radio-tracking, when - habitat is defined by several categories (e.g. several vegetation - types, see Calenge and Dufour 2006).\cr - - This analysis can be used for both designs II (same availability for - all animals, e.g. selection of the home range within the study area) - and designs III (different availability, e.g. selection of the sites - within the home range). In the latter case, when some available - proportions are equal to zero, the selection ratios are replaced by - their expectation under random habitat use, following the - recommendations of Calenge and Dufour (2006). -} -\value{ - An object of class \code{esr} -} -\references{ - Calenge, C. and Dufour, A.B. (2006) Eigenanalysis of selection ratios - from animal radio-tracking data. \emph{Ecology}. \bold{in press}. -} -\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } -\seealso{ \code{\link{widesII}} for further information about the - selection ratios, \code{\link{compana}} for compositional analysis.} -\examples{ - -########################################################### -########################################################### -### -### Example given in Calenge and Dufour 2006 (design II) - - -data(squirrel) - -## computation of the number of relocations in each habitat type -## from the data given by Aebischer et al. (1993). -## squirrel$locs give the percentage of relocations in each habitat -## type, and Aebischer et al. (1993) indicate that there are 30 -## relocations per animal. -## We therefore compute the number of relocations in each habitat type -## using: -us <- round(30 * squirrel$locs / 100) - -## Habitat availability -av <- squirrel$studyarea - -## Eigenanalysis of selection ratios -ii <- eisera(us, av, scannf = FALSE) - -scatter(ii, grid = FALSE, clab = 0.7) - -########################################################### -########################################################### -### -### Example of design III - -iii <- eisera(us, squirrel$mcp, scannf = FALSE) -scatter(iii, grid = FALSE, clab = 0.7) - -} -\keyword{multivariate} -\keyword{hplot} +\name{eisera} +\alias{eisera} +\alias{print.esr} +\alias{scatter.esr} +\title{Eigenanalysis of Selection Ratios} +\description{ + Performs an eigenanalysis of selection ratios. +} +\usage{ +eisera(used, available, scannf = TRUE, nf = 2) +print.esr(x, \dots) +scatter.esr(x, xax = 1, yax = 2, + csub = 1, possub = "bottomleft", \dots) +} +\arguments{ + \item{used}{a data frame containing the *number* of relocations of + each animal (rows) in each habitat type (columns) } + \item{available}{a data frame containing the *proportion* of + availability of each habitat type (columns) to each animal (rows)} + \item{scannf}{logical. Whether the eigenvalues bar plot should be + displayed} + \item{nf}{if \code{scannf = FALSE}, an integer indicating the number + of kept axes} + \item{x}{an object of class \code{esr}} + \item{xax}{the column number for the x-axis} + \item{yax}{the column number for the y-axis} + \item{csub}{a character size for the legend, used with + \code{par("cex")*csub}} + \item{possub}{a string of characters indicating the sub-title + position ("topleft", "topright", "bottomleft", + "bottomright")} + \item{\dots}{further arguments passed to or from other methods} +} +\details{ + The eigenanalysis of selection ratios has been developped to explore + habitat selection by animals monitored using radio-tracking, when + habitat is defined by several categories (e.g. several vegetation + types, see Calenge and Dufour 2006).\cr + + This analysis can be used for both designs II (same availability for + all animals, e.g. selection of the home range within the study area) + and designs III (different availability, e.g. selection of the sites + within the home range). In the latter case, when some available + proportions are equal to zero, the selection ratios are replaced by + their expectation under random habitat use, following the + recommendations of Calenge and Dufour (2006). +} +\value{ + An object of class \code{esr} +} +\references{ + Calenge, C. and Dufour, A.B. (2006) Eigenanalysis of selection ratios + from animal radio-tracking data. \emph{Ecology}. \bold{in press}. +} +\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } +\seealso{ \code{\link{widesII}} for further information about the + selection ratios, \code{\link{compana}} for compositional analysis.} +\examples{ + +########################################################### +########################################################### +### +### Example given in Calenge and Dufour 2006 (design II) + + +data(squirrel) + +## computation of the number of relocations in each habitat type +## from the data given by Aebischer et al. (1993). +## squirrel$locs give the percentage of relocations in each habitat +## type, and Aebischer et al. (1993) indicate that there are 30 +## relocations per animal. +## We therefore compute the number of relocations in each habitat type +## using: +us <- round(30 * squirrel$locs / 100) + +## Habitat availability +av <- squirrel$studyarea + +## Eigenanalysis of selection ratios +ii <- eisera(us, av, scannf = FALSE) + +scatter(ii, grid = FALSE, clab = 0.7) + +## The following graph may help the interpretation +## (see Calenge and Dufour 2006) +data(squirreloc) +locs <- squirreloc$locs +are <- squirreloc$map +co <- attr(are, "info") + +li <- split(locs[,2:3], locs[,1]) +opar <- par(mfrow=n2mfrow(length(li)), mar=c(0,0,2,0)) +lapply(1:length(li), function(i) { +plot(are, colp = co[,2], main=names(li)[i], axes=FALSE) +points(li[[i]], pch=16, cex=1.5) +box() +}) +par(opar) + + +########################################################### +########################################################### +### +### Example of design III + +iii <- eisera(us, squirrel$mcp, scannf = FALSE) +scatter(iii, grid = FALSE, clab = 0.7) + +} +\keyword{multivariate} +\keyword{hplot} diff --git a/man/enfa.Rd b/man/enfa.Rd index f4df4e7..682b725 100755 --- a/man/enfa.Rd +++ b/man/enfa.Rd @@ -141,7 +141,7 @@ map[,4] <- sqrt(map[,4]) hist(map, type = "l") ## We prepare the data for the ENFA -(dataenfa1 <- data2enfa(map, locs[tmp, c("X","Y")])) +(dataenfa1 <- data2enfa(map, locs)) ## We then perform the ENFA (enfa1 <- enfa(dataenfa1$tab, dataenfa1$pr, diff --git a/man/gdltraj.Rd b/man/gdltraj.Rd index a667a86..8d95fb7 100755 --- a/man/gdltraj.Rd +++ b/man/gdltraj.Rd @@ -1,50 +1,50 @@ -\name{gdltraj} -\alias{gdltraj} -\title{Working with Trajectories: Specify a Time Period} -\description{ - Gets the parts of the trajectories stored in an object of class - \code{ltraj}, corresponding to a specified time period. -} -\usage{ -gdltraj(x, min, max, type = c("POSIXct", "sec", "min", "hour", "mday", - "mon", "year", "wday", "yday")) -} -\arguments{ - \item{x}{an object of class \code{ltraj} } - \item{min}{numeric. The beginning of the period to consider} - \item{max}{numeric. The end of the period to consider} - \item{type}{character. The time units of \code{min} and - \code{max}} -} -\details{ - The limits of the period to consider may correspond to any of the - components of the list of class \code{POSIXlt} (hour, day, month, - etc.; see \code{help(POSIXlt)}), or to dates stored in objects of - class \code{POSIXct} (see examples). -} -\value{ - an object of class \code{ltraj}. -} -\author{Clément Calenge \email{calenge@biomserv.univ-lyon1.fr}} -\seealso{\code{\link{as.ltraj}} for further information about objects of - class \code{ltraj}, \code{\link{POSIXlt}} for further information - about objects of class \code{POSIXlt}} -\examples{ -data(puechcirc) -plot(puechcirc, perani = FALSE) - -## gets all the relocations collected -## between midnight and 3H AM -toto <- gdltraj(puechcirc, min = 0, max = 3, type="hour") -plot(toto, perani = FALSE) - -## gets all relocations collected between the 15th -## and the 25th august 1993 -lim <- as.POSIXct(strptime(c("15/08/1993", "25/08/1993"), - "\%d/\%m/\%Y")) -tutu <- gdltraj(puechcirc, min = lim[1], - max = lim[2], type="POSIXct") -plot(tutu, perani = FALSE) - -} -\keyword{spatial} +\name{gdltraj} +\alias{gdltraj} +\title{Working with Trajectories: Specify a Time Period} +\description{ + Gets the parts of the trajectories stored in an object of class + \code{ltraj}, corresponding to a specified time period. +} +\usage{ +gdltraj(x, min, max, type = c("POSIXct", "sec", "min", "hour", "mday", + "mon", "year", "wday", "yday")) +} +\arguments{ + \item{x}{an object of class \code{ltraj} } + \item{min}{numeric. The beginning of the period to consider} + \item{max}{numeric. The end of the period to consider} + \item{type}{character. The time units of \code{min} and + \code{max}} +} +\details{ + The limits of the period to consider may correspond to any of the + components of the list of class \code{POSIXlt} (hour, day, month, + etc.; see \code{help(POSIXlt)}), or to dates stored in objects of + class \code{POSIXct} (see examples). +} +\value{ + an object of class \code{ltraj}. +} +\author{Clément Calenge \email{calenge@biomserv.univ-lyon1.fr}} +\seealso{\code{\link{as.ltraj}} for further information about objects of + class \code{ltraj}, \code{\link{POSIXlt}} for further information + about objects of class \code{POSIXlt}} +\examples{ +data(puechcirc) +plot(puechcirc, perani = FALSE) + +## gets all the relocations collected +## between midnight and 3H AM +toto <- gdltraj(puechcirc, min = 0, max = 3, type="hour") +plot(toto, perani = FALSE) + +## gets all relocations collected between the 15th +## and the 25th august 1993 +lim <- as.POSIXct(strptime(c("15/08/1993", "25/08/1993"), + "\%d/\%m/\%Y")) +tutu <- gdltraj(puechcirc, min = lim[1], + max = lim[2], type="POSIXct") +plot(tutu, perani = FALSE) + +} +\keyword{spatial} diff --git a/man/import.asc.Rd b/man/import.asc.Rd index a2e18ca..a45e3bb 100755 --- a/man/import.asc.Rd +++ b/man/import.asc.Rd @@ -84,7 +84,7 @@ Landserf: \url{http://www.soi.city.ac.uk/~jwo/landserf/} ## Importation of asc files: numeric ## Path of the file to be imported (file1 <- paste(system.file(package = "adehabitat"), - "ascfiles/Elevation.asc", sep = "/")) + "ascfiles/elevation.asc", sep = "/")) el <- import.asc(file1) image(el) @@ -93,9 +93,9 @@ el ## Importation of asc files: factor (file2 <- paste(system.file(package = "adehabitat"), - "ascfiles/Aspect.asc", sep = "/")) + "ascfiles/aspect.asc", sep = "/")) (levelfile <- paste(system.file(package = "adehabitat"), - "ascfiles/Aspect.txt", sep = "/")) + "ascfiles/aspect.txt", sep = "/")) asp <- import.asc(file2, lev = levelfile, type = "factor") image(asp) asp diff --git a/man/kasc2spixdf.Rd b/man/kasc2spixdf.Rd index a4df02e..0a3eddf 100755 --- a/man/kasc2spixdf.Rd +++ b/man/kasc2spixdf.Rd @@ -7,6 +7,8 @@ \alias{attpol2area} \alias{traj2spdf} \alias{traj2sldf} +\alias{ltraj2spdf} +\alias{ltraj2sldf} \title{ Conversion of maps from/to the package "sp" } \description{ These functions convert maps of classes available in adehabitat toward @@ -37,6 +39,12 @@ \cr \code{traj2sldf} converts an object of class \code{traj} into an object of class \code{SpatialLinesDataFrame}.\cr + \cr + \code{ltraj2sldf} converts an object of class \code{ltraj} into an + object of class \code{SpatialLinesDataFrame}.\cr + \cr + \code{ltraj2spdf} converts an object of class \code{ltraj} into an + object of class \code{SpatialPointsDataFrame}.\cr } \usage{ kasc2spixdf(ka) @@ -47,6 +55,8 @@ spol2area(sr) attpol2area(srdf) traj2spdf(tr) traj2sldf(tr, byid = FALSE) +ltraj2spdf(ltr) +ltraj2sldf(ltr, byid = FALSE) } \arguments{ \item{ka}{an object of class \code{kasc}.} @@ -58,6 +68,7 @@ traj2sldf(tr, byid = FALSE) \code{SpatialPolygonsDataFrame}.} \item{srdf}{an object of class \code{SpatialPolygonsDataFrame}.} \item{tr}{an object of class \code{traj}.} + \item{ltr}{an object of class \code{ltraj}.} \item{byid}{logical. If \code{TRUE}, one objects of class \code{Lines} correspond to one animal. if \code{FALSE}, one object of class \code{Lines} correspond to one burst.} @@ -75,7 +86,9 @@ traj2sldf(tr, byid = FALSE) \seealso{ \code{\link{import.asc}} for information on objects of class \code{asc}, \code{\link{as.kasc}} for info on objects of class \code{kasc}, \code{\link{as.area}} for info on objects of - class \code{area}, \code{\link{as.traj}} for objects of class \code{traj}.} + class \code{area}, \code{\link{as.traj}} for objects of class + \code{traj}, \code{\link{as.ltraj}} for objects of class + \code{ltraj}.} \examples{ \dontrun{ if (require(sp)) { @@ -138,25 +151,23 @@ area.plot(coincoin, values = haha$Waechter) ######################################### ## -## Conversion traj -> SpatialPointsDataFrame +## Conversion ltraj -> SpatialPointsDataFrame ## data(puechcirc) plot(puechcirc) -toto <- traj2spdf(puechcirc) +toto <- ltraj2spdf(puechcirc) plot(toto) + ######################################### ## -## Conversion traj -> SpatialLinesDataFrame +## Conversion ltraj -> SpatialLinesDataFrame ## -data(puechcirc) -plot(puechcirc) - -toto <- traj2sldf(puechcirc) +toto <- ltraj2sldf(puechcirc) plot(toto) } diff --git a/man/kernelUD.Rd b/man/kernelUD.Rd index 99bdef3..a343b8e 100755 --- a/man/kernelUD.Rd +++ b/man/kernelUD.Rd @@ -93,11 +93,11 @@ kernelbb(tr, sig1, sig2, grid = 40, same4all=FALSE, byburst=FALSE) square meters, \code{"km2"} for square kilometers or \code{"ha"} for hectares (default)} \item{lev}{the percentage level for home range contour estimation.} - \item{tr}{an object of class \code{traj}.} + \item{tr}{an object of class \code{ltraj}.} \item{sig1}{first smoothing parameter for the brownian bridge method - (related to the imprecision of the relocations).} - \item{sig2}{second smoothing parameter for the brownian bridge method (related to the speed of the animals).} + \item{sig2}{second smoothing parameter for the brownian bridge method + (related to the imprecision of the relocations).} \item{byburst}{logical. Whether the brownian bridge estimation should be done by burst.} \item{\dots}{additionnal parameters to be passed to the generic @@ -140,7 +140,7 @@ kernelbb(tr, sig1, sig2, grid = 40, same4all=FALSE, byburst=FALSE) Epanechnikov kernel, which requires less computer time is also available for the estimation of the UD. \cr - The function \code{getvolumehr} modifies the UD component of the + The function \code{getvolumeUD} modifies the UD component of the object passed as argument, so that the contour of the UD displayed by the functions \code{contour} and \code{image.khr} corresponds to the different percentage levels of @@ -330,20 +330,19 @@ par(opar) data(puechcirc) ## gets one circuit -x <- getburst(puechcirc, burst = "CH930824") +x <- puechcirc[burst = "CH930824"] ## fits the home range (tata <- kernelbb(x, 10, 10, same4all = TRUE)) image(tata) -lines(x$x, x$y, lwd = 2, col = "red") +lines(x[[1]]$x, x[[1]]$y, lwd = 2, col = "red") ## Image of a brownian bridge. Fit with two relocations: -fac <- factor(c("a", "a")) xx <- c(0,1) yy <- c(0,1) date <- c(0,1) class(date) <- c("POSIXt", "POSIXct") -tr <- as.traj(fac, data.frame(x = xx,y = yy), date) +tr <- as.ltraj(data.frame(x = xx,y = yy), date, id="a") ## Use of different smoothing parameters sig1 <- c(0.05, 0.1, 0.2, 0.4, 0.6) @@ -362,7 +361,7 @@ opar <- par(mar = c(0,0,2,0), mfrow = c(5,5)) foo <- function(x) { image(y[[x]], main = names(y)[x], axes = F) - points(tr[,c("x","y")], pch = 16, col = "red") + points(tr[[1]][,c("x","y")], pch = 16, col = "red") } lapply(1:length(y), foo) diff --git a/man/mahasuhab.Rd b/man/mahasuhab.Rd index 918c285..79d048e 100755 --- a/man/mahasuhab.Rd +++ b/man/mahasuhab.Rd @@ -2,11 +2,11 @@ \alias{mahasuhab} \title{Habitat Suitability Mapping with Mahalanobis Distances.} \description{ -This function computes the habitat suitability map of an area -for a species, given a set of locations of the species occurences (Clark -et al. 1993). This function is -to be used in habitat selection studies, when animals are not -identified. + This function computes the habitat suitability map of an area + for a species, given a set of locations of the species occurences (Clark + et al. 1993). This function is + to be used in habitat selection studies, when animals are not + identified. } \usage{ mahasuhab(kasc, pts, type = c("distance", "probability")) @@ -36,18 +36,18 @@ mahasuhab(kasc, pts, type = c("distance", "probability")) The function \code{mahasuhab} first computes this mean vector as well as the variance-covariance matrix of the niche density function, based on the value of habitat variables in the sample of locations. - Then, the Mahalanobis distance from this optimum is computed for each pixel - of the map. Thus, the smaller this + Then, the *squared* Mahalanobis distance from this optimum is computed + for each pixel of the map. Thus, the smaller this squared distance is for a given pixel, and the better is the habitat in this pixel. - Assuming multivariate normality, Mahalanobis distances are + Assuming multivariate normality, squared Mahalanobis distances are approximately distributed as Chi-square with n-1 degrees of freedom, where n equals the number of habitat characteristics. If the argument \code{type = "probability"}, maps of these p-values are returned by the function. As such these are the probabilities of a - larger Mahalanobis distance than that observed when x is sampled from - a population whose mean is ideal. + larger squared Mahalanobis distance than that observed when x is + sampled from a population whose mean is ideal. } \value{ Returns a raster map of class \code{asc}. @@ -59,7 +59,7 @@ system. \emph{Journal of Wildlife Management}, \bold{57}, 519--526. } \author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } \note{ - The computation of the Mahalanobis distances inverts the + The computation of the squared Mahalanobis distances inverts the variance-covariance matrix of the niche density function (see \code{?mahalanobis}). It is therefore important that the habitat variables considered diff --git a/man/mcp.Rd b/man/mcp.Rd index 6b7a0ba..81fcabf 100755 --- a/man/mcp.Rd +++ b/man/mcp.Rd @@ -1,87 +1,87 @@ -\name{mcp} -\alias{mcp} -\alias{plot.hrsize} -\alias{mcp.area} -\title{Estimation of the Home Range Using the Minimum Convex Polygon - Estimator} -\description{ - \code{mcp} computes the home range of several - animals using the minimum convex polygon estimator.\cr - \code{mcp.area} is used for home-range size estimation. This function - requires the package \code{gpclib}.\cr - \code{plot.hrsize} is used to display the home-range size estimated at - various levels. -} -\usage{ -mcp(xy, id, percent = 95) -mcp.area(xy, id, percent = seq(20,95, by=5), - unin = c("m", "km"), - unout = c("ha", "km2", "m2")) -plot.hrsize(x, \dots) -} -\arguments{ - \item{xy}{a data frame containing the coordinates of the relocation - of the monitored animals} - \item{id}{a factor giving the identity of the animal for each relocation} - \item{percent}{100 minus the proportion of outliers to be excluded - from the computation } - \item{unin}{the units of the relocations coordinates. Either - \code{"m"} (default) for - meters or \code{"km"} for kilometers} - \item{unout}{the units of the output areas. Either \code{"m2"} for - square meters, \code{"km2"} for square kilometers or \code{"ha"} for - hectares (default)} - \item{x}{an objet of class \code{hrsize} returned by the function - \code{mcp.area}, or \code{kernel.area} (see the help page of this - function)} - \item{\dots}{additionnal arguments to be passed to the function - \code{plot}} -} -\details{ - This function computes the Minimum Convex Polygon estimation after the - removal of \code{(100 minus percent)} percent of the relocations the - farthest away from the barycenter of the home range (computed by the - arithmetic mean of the coordinates of the relocations for each - animal).\cr -} -\value{ - \code{mcp} returns an object of class \code{area}, with one polygon - per level of the factor ID.\cr - \code{mcp.area} returns a data frame of class \code{hrsize}, - with one column per animal and one row per level of - estimation of the home range -} -\references{ - Mohr, C.O. (1947) Table of equivalent populations of north - american small mammals. \emph{The American Midland Naturalist}, - \bold{37}, 223-249.} -\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } - -\seealso{ \code{\link[grDevices]{chull}}, \code{\link{plot.area}} to have a - graphical display of the home ranges, \code{\link{as.area}} for - additionnal information on the class \code{area}, and - \code{\link{area2dxf}} for further exportation toward a GIS. - \code{\link[ade4]{s.chull}} for another way to display MCP} -\examples{ -data(puechabon) -locs <- puechabon$locs - -cp <- mcp(locs[,4:5], locs[,1]) - -## Plot the home ranges -opar <- par(mar = c(0,0,0,0)) -area.plot(cp) - -## ... And the relocations -points(locs[,4:5], pch = 16, col = as.numeric(locs[,1])) -par(opar) - -## Computation of the home-range size: -if (require(gpclib)) { - (cuicui1 <- mcp.area(locs[,4:5], locs[,1])) - plot(cuicui1) -} - -} - -\keyword{hplot} +\name{mcp} +\alias{mcp} +\alias{plot.hrsize} +\alias{mcp.area} +\title{Estimation of the Home Range Using the Minimum Convex Polygon + Estimator} +\description{ + \code{mcp} computes the home range of several + animals using the minimum convex polygon estimator.\cr + \code{mcp.area} is used for home-range size estimation. This function + requires the package \code{gpclib}.\cr + \code{plot.hrsize} is used to display the home-range size estimated at + various levels. +} +\usage{ +mcp(xy, id, percent = 95) +mcp.area(xy, id, percent = seq(20,95, by=5), + unin = c("m", "km"), + unout = c("ha", "km2", "m2")) +plot.hrsize(x, \dots) +} +\arguments{ + \item{xy}{a data frame containing the coordinates of the relocation + of the monitored animals} + \item{id}{a factor giving the identity of the animal for each relocation} + \item{percent}{100 minus the proportion of outliers to be excluded + from the computation } + \item{unin}{the units of the relocations coordinates. Either + \code{"m"} (default) for + meters or \code{"km"} for kilometers} + \item{unout}{the units of the output areas. Either \code{"m2"} for + square meters, \code{"km2"} for square kilometers or \code{"ha"} for + hectares (default)} + \item{x}{an objet of class \code{hrsize} returned by the function + \code{mcp.area}, or \code{kernel.area} (see the help page of this + function)} + \item{\dots}{additionnal arguments to be passed to the function + \code{plot}} +} +\details{ + This function computes the Minimum Convex Polygon estimation after the + removal of \code{(100 minus percent)} percent of the relocations the + farthest away from the barycenter of the home range (computed by the + arithmetic mean of the coordinates of the relocations for each + animal).\cr +} +\value{ + \code{mcp} returns an object of class \code{area}, with one polygon + per level of the factor ID.\cr + \code{mcp.area} returns a data frame of class \code{hrsize}, + with one column per animal and one row per level of + estimation of the home range +} +\references{ + Mohr, C.O. (1947) Table of equivalent populations of north + american small mammals. \emph{The American Midland Naturalist}, + \bold{37}, 223-249.} +\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } + +\seealso{ \code{\link[grDevices]{chull}}, \code{\link{plot.area}} to have a + graphical display of the home ranges, \code{\link{as.area}} for + additionnal information on the class \code{area}, and + \code{\link{area2dxf}} for further exportation toward a GIS. + \code{\link[ade4]{s.chull}} for another way to display MCP} +\examples{ +data(puechabon) +locs <- puechabon$locs + +cp <- mcp(locs[,4:5], locs[,1]) + +## Plot the home ranges +opar <- par(mar = c(0,0,0,0)) +area.plot(cp) + +## ... And the relocations +points(locs[,4:5], pch = 16, col = as.numeric(locs[,1])) +par(opar) + +## Computation of the home-range size: +if (require(gpclib)) { + (cuicui1 <- mcp.area(locs[,4:5], locs[,1])) + plot(cuicui1) +} + +} + +\keyword{hplot} diff --git a/man/plot.ltraj.Rd b/man/plot.ltraj.Rd index e03c5d6..a9e8915 100755 --- a/man/plot.ltraj.Rd +++ b/man/plot.ltraj.Rd @@ -1,63 +1,63 @@ -\name{plot.ltraj} -\alias{plot.ltraj} -\title{Graphical Display of an Object of Class "ltraj"} -\description{ - \code{plot.ltraj} allows various graphical displays of the - trajectories. -} -\usage{ -plot.ltraj(x, id = unique(unlist(lapply(x, attr, which = "id"))), - burst = unlist(lapply(x, attr, which = "burst")), asc = NULL, - area = NULL, xlim = NULL, ylim = NULL, colasc = - gray((240:1)/256), colpol = "green", addpoints = TRUE, - addlines = TRUE, perani = TRUE, final = TRUE, ...) -} -\arguments{ - \item{x}{an object of class \code{ltraj}} - \item{id}{a character vector containing the identity of the - individuals of interest} - \item{burst}{a character vector containing the burst levels of - interest} - \item{asc}{an object of class \code{asc}} - \item{area}{an object of class \code{area}} - \item{xlim}{the ranges to be encompassed by the x axis} - \item{ylim}{the ranges to be encompassed by the y axis} - \item{colasc}{a character vector giving the colors of the map of class - \code{asc}} - \item{colpol}{a character vector giving the colors of the polygon contour - map, when \code{area} is not \code{NULL}} - \item{addpoints}{logical. If \code{TRUE}, points corresponding to - each relocation are drawn} - \item{addlines}{logical. If \code{TRUE}, points corresponding to each - relocation are drawn} - \item{perani}{logical. If \code{TRUE}, one plot is drawn for each - value of \code{id}, and the several bursts are superposed on the - same plot for a given animal. If \code{FALSE}, one plot is drawn - for each value of \code{burst} } - \item{final}{logical. If \code{TRUE}, the initial and final - relocations of each burst are indicated in blue and red, - respectively} - \item{\dots}{arguments to be passed to the generic - function \code{plot} } -} -\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } -\seealso{For further information on the class \code{ltraj}, - \code{\link{as.ltraj}}. } -\examples{ - -data(puechcirc) - -plot(puechcirc) -plot(puechcirc, perani = FALSE) -plot(puechcirc, id = "JE93", perani = FALSE) - -data(puechabon) -ele <- getkasc(puechabon$kasc, "Elevation") -plot(puechcirc, perani = FALSE, asc = ele) - -cont <- getcontour(ele) -plot(puechcirc, area = cont) - -} -\keyword{spatial} -\keyword{hplot} +\name{plot.ltraj} +\alias{plot.ltraj} +\title{Graphical Display of an Object of Class "ltraj"} +\description{ + \code{plot.ltraj} allows various graphical displays of the + trajectories. +} +\usage{ +plot.ltraj(x, id = unique(unlist(lapply(x, attr, which = "id"))), + burst = unlist(lapply(x, attr, which = "burst")), asc = NULL, + area = NULL, xlim = NULL, ylim = NULL, colasc = + gray((240:1)/256), colpol = "green", addpoints = TRUE, + addlines = TRUE, perani = TRUE, final = TRUE, ...) +} +\arguments{ + \item{x}{an object of class \code{ltraj}} + \item{id}{a character vector containing the identity of the + individuals of interest} + \item{burst}{a character vector containing the burst levels of + interest} + \item{asc}{an object of class \code{asc}} + \item{area}{an object of class \code{area}} + \item{xlim}{the ranges to be encompassed by the x axis} + \item{ylim}{the ranges to be encompassed by the y axis} + \item{colasc}{a character vector giving the colors of the map of class + \code{asc}} + \item{colpol}{a character vector giving the colors of the polygon contour + map, when \code{area} is not \code{NULL}} + \item{addpoints}{logical. If \code{TRUE}, points corresponding to + each relocation are drawn} + \item{addlines}{logical. If \code{TRUE}, points corresponding to each + relocation are drawn} + \item{perani}{logical. If \code{TRUE}, one plot is drawn for each + value of \code{id}, and the several bursts are superposed on the + same plot for a given animal. If \code{FALSE}, one plot is drawn + for each value of \code{burst} } + \item{final}{logical. If \code{TRUE}, the initial and final + relocations of each burst are indicated in blue and red, + respectively} + \item{\dots}{arguments to be passed to the generic + function \code{plot} } +} +\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } +\seealso{For further information on the class \code{ltraj}, + \code{\link{as.ltraj}}. } +\examples{ + +data(puechcirc) + +plot(puechcirc) +plot(puechcirc, perani = FALSE) +plot(puechcirc, id = "JE93", perani = FALSE) + +data(puechabon) +ele <- getkasc(puechabon$kasc, "Elevation") +plot(puechcirc, perani = FALSE, asc = ele) + +cont <- getcontour(ele) +plot(puechcirc, area = cont) + +} +\keyword{spatial} +\keyword{hplot} diff --git a/man/puechcirc.Rd b/man/puechcirc.Rd index d191c93..d7763e3 100755 --- a/man/puechcirc.Rd +++ b/man/puechcirc.Rd @@ -1,25 +1,25 @@ -\name{puechcirc} -\alias{puechcirc} -\docType{data} -\title{Movements of wild boars tracked at Puechabon} -\description{ -This data set is an object of class \code{ltraj}, giving the results of the -monitoring of 2 wild boars by radio-tracking at Puéchabon (Mediterranean -habitat, South of France). These data have been -collected by Daniel Maillard (Office national de la chasse et de la -faune sauvage), and correspond to the activity period of the wild boar -(during the night, when the animals forage. The data set -\code{puechabon} describes the resting sites). -} -\usage{data(puechcirc)} -\format{ - This object has, in total, 204 relocations distributed among two - animals and four bursts of relocations (\code{CH930803}, \code{CH930824}, - \code{CH930827}, \code{JE930819}, and \code{JE930827}). -} -\source{ -Maillard, D. (1996). \emph{Occupation et utilisation de la garrigue et - du vignoble méditerranéens par le Sanglier}. -Université d'Aix-Marseille III: PhD thesis. -} -\keyword{datasets} +\name{puechcirc} +\alias{puechcirc} +\docType{data} +\title{Movements of wild boars tracked at Puechabon} +\description{ +This data set is an object of class \code{ltraj}, giving the results of the +monitoring of 2 wild boars by radio-tracking at Puéchabon (Mediterranean +habitat, South of France). These data have been +collected by Daniel Maillard (Office national de la chasse et de la +faune sauvage), and correspond to the activity period of the wild boar +(during the night, when the animals forage. The data set +\code{puechabon} describes the resting sites). +} +\usage{data(puechcirc)} +\format{ + This object has, in total, 204 relocations distributed among two + animals and four bursts of relocations (\code{CH930803}, \code{CH930824}, + \code{CH930827}, \code{JE930819}, and \code{JE930827}). +} +\source{ +Maillard, D. (1996). \emph{Occupation et utilisation de la garrigue et + du vignoble méditerranéens par le Sanglier}. +Université d'Aix-Marseille III: PhD thesis. +} +\keyword{datasets} diff --git a/man/randtest.enfa.Rd b/man/randtest.enfa.Rd index 8061815..3ad448e 100755 --- a/man/randtest.enfa.Rd +++ b/man/randtest.enfa.Rd @@ -50,8 +50,9 @@ data(chamois) locs <- chamois$locs map <- chamois$map map$Vegetation <- NULL -en <- enfa(map, locs, scannf=F) -(tutu <- randtest(en)) +da <- data2enfa(map, locs) +en <- enfa(da$tab, da$pr, scannf = F) +(tutu <- randtest(en, nrepet = 100)) plot(tutu) } } diff --git a/man/rotxy.Rd b/man/rotxy.Rd index f694438..7727571 100755 --- a/man/rotxy.Rd +++ b/man/rotxy.Rd @@ -4,7 +4,10 @@ \alias{profilehab} \alias{[.kasc} \alias{[[.kasc} -\title{ Internal Functions for Package 'adehabitat' } +\alias{NNCH.iso.index} +\alias{vectorize.parameter} +\alias{noholes.poly} +\title{Internal Functions for Package 'adehabitat'} \description{ Internal functions for the package \code{adehabitat}. } diff --git a/man/schoener.Rd b/man/schoener.Rd index 7af4d2c..af71486 100755 --- a/man/schoener.Rd +++ b/man/schoener.Rd @@ -1,85 +1,85 @@ -\name{schoener} -\alias{schoener} -\alias{schoener.rtest} -\title{Compute Schoener's ratio } -\description{ - \code{schoener} computes the Schoener's ratio on radio-tracking data.\cr - \code{schoener.rtest} performs a randomization test of the equality of - the Schoener's ratio to 2\cr -} -\usage{ -schoener(tr, keep, byburst = TRUE) -schoener.rtest(tr, keep, byburst = TRUE, nrep = 500) -} -\arguments{ - \item{tr}{an object of class \code{traj} } - \item{keep}{a vector of length 2, giving the lower and the upper bound - of the time interval for which a pair of relocations is considered - in the computation of t\^2 (see details). These values are given in - seconds.} - \item{byburst}{logical. If \code{TRUE}, the Schoener's ratio is - computed by burst. If \code{FALSE}, the ratio is computed by - animal.} - \item{nrep}{the number of randomisations of the test. } - -} -\details{ - The Schoener's ratio is a measure of time-autocorrelation in the data. - This ratio is computed as the squared mean distance between "neighbour" - relocations (t\^2) divided by the squared mean distance between the - relocations and their barycenter (r\^2). The theoretical value of this - ratio under the hypothesis of independance of the relocations is 2.\cr - - Swihart and Slade (1985) consider as neighbour two successive - relocations. However, the Schoener's ratio computed in this way makes - sense biologically only if the relocations are equally spaced in - time. However, as indicated by these authors, "such a data set - probably is the exception rather than the rule because many problems - may arise in taking a locational reading at a specified time".\cr - - In this function, we define as "neighbour" two relocations (not - necessarily successive relocations) separated by a time interval - comprised within the bounds specified in the vector \code{keep} (in - seconds). For example, if \code{keep = c(60, 300)}, all relocations - separated by a time interval comprised between 1 and 5 minutes are - considered in the computation. Thus, the total number of pairs of - relocations m taken into account in the computation may be larger than - the number of relocations n (m can be at most equal to n*(n-1)/2). - -} -\value{ - returns an object of class \code{schoener}. -} -\references{ - Schoener, T.W. (1981) An empirically based estimate of home - range. \emph{Theoretical Population Biology}, \bold{20}, 281--325. - - Swihart, R.K. and Slade, N.A. (1985) Testing for independence of - observations in animal movements. \emph{Ecology}, \bold{66}, - 1176--1184. - - Solow, A.R. (1989) A randomization test for independence of animal - locations. \emph{Ecology}, \bold{70}, 1546--1549. -} -\author{Clément Calenge \email{calenge@biomserv.univ-lyon1.fr}} - -\examples{ - -data(puechcirc) -puechcirc <- ltraj2traj(puechcirc) -puechcirc$date[1:10] - -## Relocations are taken every 10 minutes -## For example we consider relocations as -## neighbour when they are separated by a time -## interval comprised between 5 and 15 minutes -schoener(puechcirc, keep = c(5*60, 15*60)) -\dontrun{ -schoener.rtest(puechcirc, keep = c(5*60, 15*60)) -} - - - -} -\keyword{math} - +\name{schoener} +\alias{schoener} +\alias{schoener.rtest} +\title{Compute Schoener's ratio } +\description{ + \code{schoener} computes the Schoener's ratio on radio-tracking data.\cr + \code{schoener.rtest} performs a randomization test of the equality of + the Schoener's ratio to 2\cr +} +\usage{ +schoener(tr, keep, byburst = TRUE) +schoener.rtest(tr, keep, byburst = TRUE, nrep = 500) +} +\arguments{ + \item{tr}{an object of class \code{traj} } + \item{keep}{a vector of length 2, giving the lower and the upper bound + of the time interval for which a pair of relocations is considered + in the computation of t\^2 (see details). These values are given in + seconds.} + \item{byburst}{logical. If \code{TRUE}, the Schoener's ratio is + computed by burst. If \code{FALSE}, the ratio is computed by + animal.} + \item{nrep}{the number of randomisations of the test. } + +} +\details{ + The Schoener's ratio is a measure of time-autocorrelation in the data. + This ratio is computed as the squared mean distance between "neighbour" + relocations (t\^2) divided by the squared mean distance between the + relocations and their barycenter (r\^2). The theoretical value of this + ratio under the hypothesis of independance of the relocations is 2.\cr + + Swihart and Slade (1985) consider as neighbour two successive + relocations. However, the Schoener's ratio computed in this way makes + sense biologically only if the relocations are equally spaced in + time. However, as indicated by these authors, "such a data set + probably is the exception rather than the rule because many problems + may arise in taking a locational reading at a specified time".\cr + + In this function, we define as "neighbour" two relocations (not + necessarily successive relocations) separated by a time interval + comprised within the bounds specified in the vector \code{keep} (in + seconds). For example, if \code{keep = c(60, 300)}, all relocations + separated by a time interval comprised between 1 and 5 minutes are + considered in the computation. Thus, the total number of pairs of + relocations m taken into account in the computation may be larger than + the number of relocations n (m can be at most equal to n*(n-1)/2). + +} +\value{ + returns an object of class \code{schoener}. +} +\references{ + Schoener, T.W. (1981) An empirically based estimate of home + range. \emph{Theoretical Population Biology}, \bold{20}, 281--325. + + Swihart, R.K. and Slade, N.A. (1985) Testing for independence of + observations in animal movements. \emph{Ecology}, \bold{66}, + 1176--1184. + + Solow, A.R. (1989) A randomization test for independence of animal + locations. \emph{Ecology}, \bold{70}, 1546--1549. +} +\author{Clément Calenge \email{calenge@biomserv.univ-lyon1.fr}} + +\examples{ + +data(puechcirc) +puechcirc <- ltraj2traj(puechcirc) +puechcirc$date[1:10] + +## Relocations are taken every 10 minutes +## For example we consider relocations as +## neighbour when they are separated by a time +## interval comprised between 5 and 15 minutes +schoener(puechcirc, keep = c(5*60, 15*60)) +\dontrun{ +schoener.rtest(puechcirc, keep = c(5*60, 15*60)) +} + + + +} +\keyword{math} + diff --git a/man/speed.Rd b/man/speed.Rd index a521b0e..82378cc 100755 --- a/man/speed.Rd +++ b/man/speed.Rd @@ -1,62 +1,62 @@ -\name{speed} -\alias{speed} -\title{Computes the Speed Between Successive Relocations of an Animal - - Deprecated} -\description{ - \code{speed} measures the speed between successive relocations of - animals, using objects of class \code{traj}. -} -\usage{ -speed(x, id = levels(x$id), burst = levels(x$burst), date = NULL, - units = c("seconds", "hours", "days")) -} -\arguments{ - \item{x}{an object of class \code{traj}} - \item{id}{a character vector giving the identity of the animals for - which the speed is to be computed} - \item{burst}{a character vector giving the identity of the circuits - for which the speed is to be computed (see \code{as.traj})} - \item{date}{a vector of class \code{POSIXct} of length 2 (beginning, end) - delimiting the period of interest} - \item{units}{a character string. It determines how the - speeds are computed. For example, if the coordinates are given in - meters, and if \code{units = "seconds"}, speeds are returned in - meters per second.} -} -\value{ - Returns a data frame with the following components: - \item{id}{the identity of the animal} - \item{x}{if the speed is computed between the relocation 1 and 2, - the x coordinate of the relocation 1.} - \item{y}{if the speed is computed between the relocation 1 and 2, - the y coordinate of the relocation 1.} - \item{date}{a vector of class \code{POSIXct}, giving the date of - relocation 1.} - \item{burst}{the identity of the circuit} - \item{sp.x}{the computed speed of the animal in the x direction} - \item{sp.y}{the computed speed of the animal in the y direction} - \item{speed}{the computed speed of the animal on the plane.} - \item{dt}{the duration between the two relocations (in the units given - by the parameter \code{units}).} -} -\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } -\note{ - The function \code{speed} is deprecated. The class \code{ltraj} - computes the speeds automatically (see \code{as.ltraj}). -} -\seealso{ \code{\link{as.traj}}} -\examples{ -\dontrun{ -#### Computes the speed for each wild boar -#### monitored at Puechabon -data(puechcirc) -puechcirc <- ltraj2traj(puechcirc) -puechcirc - -plot(puechcirc) -sp <- speed(puechcirc) -sp[1:4,] -} -} -\keyword{spatial} - +\name{speed} +\alias{speed} +\title{Computes the Speed Between Successive Relocations of an Animal + - Deprecated} +\description{ + \code{speed} measures the speed between successive relocations of + animals, using objects of class \code{traj}. +} +\usage{ +speed(x, id = levels(x$id), burst = levels(x$burst), date = NULL, + units = c("seconds", "hours", "days")) +} +\arguments{ + \item{x}{an object of class \code{traj}} + \item{id}{a character vector giving the identity of the animals for + which the speed is to be computed} + \item{burst}{a character vector giving the identity of the circuits + for which the speed is to be computed (see \code{as.traj})} + \item{date}{a vector of class \code{POSIXct} of length 2 (beginning, end) + delimiting the period of interest} + \item{units}{a character string. It determines how the + speeds are computed. For example, if the coordinates are given in + meters, and if \code{units = "seconds"}, speeds are returned in + meters per second.} +} +\value{ + Returns a data frame with the following components: + \item{id}{the identity of the animal} + \item{x}{if the speed is computed between the relocation 1 and 2, + the x coordinate of the relocation 1.} + \item{y}{if the speed is computed between the relocation 1 and 2, + the y coordinate of the relocation 1.} + \item{date}{a vector of class \code{POSIXct}, giving the date of + relocation 1.} + \item{burst}{the identity of the circuit} + \item{sp.x}{the computed speed of the animal in the x direction} + \item{sp.y}{the computed speed of the animal in the y direction} + \item{speed}{the computed speed of the animal on the plane.} + \item{dt}{the duration between the two relocations (in the units given + by the parameter \code{units}).} +} +\author{ Clément Calenge \email{calenge@biomserv.univ-lyon1.fr} } +\note{ + The function \code{speed} is deprecated. The class \code{ltraj} + computes the speeds automatically (see \code{as.ltraj}). +} +\seealso{ \code{\link{as.traj}}} +\examples{ +\dontrun{ +#### Computes the speed for each wild boar +#### monitored at Puechabon +data(puechcirc) +puechcirc <- ltraj2traj(puechcirc) +puechcirc + +plot(puechcirc) +sp <- speed(puechcirc) +sp[1:4,] +} +} +\keyword{spatial} + diff --git a/man/squirrel.Rd b/man/squirrel.Rd index db8ab9b..c203548 100755 --- a/man/squirrel.Rd +++ b/man/squirrel.Rd @@ -4,7 +4,8 @@ \title{Radio-Tracking Data of Squirrels} \description{ This data set describes the use and availability of 5 habitat types for -17 squirrels monitored using radio-tracking. +17 squirrels monitored using radio-tracking. See also the dataset +\code{squirreloc}. } \usage{data(squirrel)} \format{ diff --git a/man/squirreloc.Rd b/man/squirreloc.Rd new file mode 100755 index 0000000..4c1856d --- /dev/null +++ b/man/squirreloc.Rd @@ -0,0 +1,55 @@ +\name{squirreloc} +\alias{squirreloc} +\docType{data} +\title{Radio-tracking of squirrels} +\description{ + This data set contains the trajectories of 15 radio-monitored + squirrels, as well as the vector maps of habitat composition. +} +\usage{data(squirreloc)} +\format{ + This data set is a list of two objects: + \item{locs}{is a data frame containing the relocations of 15 + squirrels (with three columns: \code{id, x, y}} + \item{map}{is an object of class \code{area} containing the habitat + composition of the area. The habitat types and colour coding are + stored in the attribute "info" of this object} +} +\details{ + The dataset \code{squirreloc} comes from the Ranges VI software. It + has been used to illustrate the compositional analysis (see + \code{?compana}) and the eigenanalysis of selection ratios (see + \code{?eisera}). See also the dataset \code{squirrel}. +} +\source{ + Kenward, R.E., South, A.B. and Walls, S.S. (2003). Ranges6 v1.2 : For + the analysis of tracking and location data. Online manual. Anatrack + Ltd. Wareham, UK. ISBN 0-9546327-0-2. +} +\examples{ +data(squirreloc) + + +## habitat: +are <- squirreloc$map +co <- attr(are, "info") +plot(are, colp = co[,2]) + +legend(-10, 210, unique(co[,1]), + unique(co[,2]), bg="white") + + + +## relocations +locs <- squirreloc$locs +li <- split(locs[,2:3], locs[,1]) +opar <- par(mfrow=n2mfrow(length(li)), mar=c(0,0,2,0)) +lapply(1:length(li), function(i) { +plot(are, colp = co[,2], main=names(li)[i], axes=FALSE) +points(li[[i]], pch=16, cex=1.5) +box() +}) +par(opar) + +} +\keyword{datasets} diff --git a/man/wi.Rd b/man/wi.Rd index 6aab5e6..85f6c78 100755 --- a/man/wi.Rd +++ b/man/wi.Rd @@ -1,248 +1,248 @@ -\name{wi} -\alias{widesI} -\alias{widesII} -\alias{widesIII} -\alias{print.wiI} -\alias{print.wiII} -\alias{print.wiIII} -\alias{plot.wi} -\alias{wi} -\alias{wiI} -\alias{wiII} -\alias{wiIII} -\title{Computation of Selection Ratios for Habitat Selection Studies.} -\description{ - These functions compute the resource selection ratios (wi) for design I, II - and III data types, with resources defined by several categories. - Basic tests are also provided. -} -\usage{ -widesI(u, a, avknown = TRUE, alpha = 0.05) -widesII(u, a, avknown = TRUE, alpha = 0.05) -widesIII(u, a, avknown = TRUE, alpha = 0.05) -print.wiI(x, \dots) -print.wiII(x, \dots) -print.wiIII(x, \dots) -plot.wi(x, caxis = 0.7, clab = 1, ylog = FALSE, errbar = c("CI", "SE"), - main = "Manly selectivity measure", noorder = TRUE, \dots) -} -\arguments{ - \item{u}{for \code{widesI}, a vector with named elements describing - the sample of used resource units. For \code{widesII} and - \code{widesIII} a matrix or a data frame giving the number of used - resource units for each animal (in rows) in each resource category - (in columns)} - \item{a}{for \code{widesI} and \code{widesII}, a vector with named - elements describing the sample or the proportion of available - resource units. For \code{widesIII} a matrix or a - data frame giving the number or the proportion of available resource - units for each animal (in rows) in each resource category (in - columns)} - \item{avknown}{logical. \code{TRUE} if the available - proportions are known, and \code{FALSE} if they are estimated} - \item{alpha}{the threshold value for the tests and confidence - intervals} - \item{x}{an object of class \code{wi}} - \item{caxis}{character size on axes to be passed to - \code{par("cex.axis")}} - \item{clab}{character size of axes labels to be passed to - \code{par("cex.lab")}} - \item{ylog}{logical. If \code{TRUE}, the selection ratios are plotted - on a log scale} - \item{errbar}{a character string. Type of error bars: either \code{"CI"} - for confidence intervals or \code{"SE"} for standard errors} - \item{main}{a character string. The title of the graph} - \item{noorder}{logical. If \code{TRUE}, the habitat categories are - ordered on the graph in decreasing order of their preference. If - FALSE, they are not ordered (i.e. they are in the same order as the - columns in \code{used} and \code{available}} - \item{\dots}{additionnal arguments to be passed to the function - \code{plot}} -} -\details{ - \code{widesI} may be used to explore resource selection by - animals, when designs I are involved (habitat use and availability are - measured at the population level - animals are not identified). The - function tests habitat selection with the Khi2 of Pearson - and log-likelihood Khi2 (recommended, see Manly et al. 2003). The - Manly selectivity measure (selection ratio = used/available) is - computed, the preference / avoidance is tested for - each habitat, and the differences between selection ratios are computed - and tested. \cr - - \code{widesII} computes the selection ratios with design II - data (same availability for all animals, but use measured for each one). - Tests of identical habitat use for all animals, and of habitat - selection are also provided.\cr - - \code{widesIII} computes the - selection ratios for design III data (when the use and the - availability are measured for each animal - - see examples on the wild boar below). Habitat selection is tested - using a Chi-square for each animal, and the overall habitat selection - is also tested. -} -\value{ - \code{widesI} returns a list of the class \code{wiI}. \code{widesII} - returns a list of class \code{wiII}. \code{widesIII} - returns a list of class \code{wiIII}. These objects are all - inheriting from the class \code{wi}. They have the following components: - \item{used.prop}{the proportion of use for each resource type.} - \item{avail.prop}{the proportion of available resources.} - \item{wi}{the Manly selectivity measure (selection ratio: - used/available).} - \item{se.wi}{the standard error of the selection ratios.} - \item{comparisons}{a list with the following components:\describe{ - \item{\code{diffwi}}{a matrix with the differences of the selection - ratios for each pair of resource type.} - \item{\code{ICdiffupper}}{a matrix containing the upper limit of confidence - interval on the differences of the selection ratios between each - pair of resource type.} - \item{\code{ICdifflower}}{a matrix containing the lower limit of confidence - interval on the differences of the selection ratios between each - pair of resource type.} - \item{\code{signif}}{the ranking matrix, with the sign of the differences - between the resource type in row and the resource type in - column. When the difference is significant, the sign is - tripled.} - } - } - \item{profile}{the profile of preferences: resource types are sorted - so that the left type is the most preferred and the right type is - the most avoided. Habitats for which the selection ratios are not - significant are connected by a line.} - \item{alpha}{the parameter \code{alpha} of this function.} - \item{avknown}{the parameter \code{avknown} of this function.} - \item{se.used}{only for designs I, the standard error of - the proportion of use.} - \item{se.avail}{only for designs I, the standard error of - the available proportion.} - \item{chisquwi}{only for designs I, the results of Chi-Square tests of the - hypothesis that the selection ratios are in average equals to zero.} - \item{Bi}{only for designs I, equals to \code{wi/sum(wi)}.} - \item{Khi2P}{only for designs I, test of random resource use (Pearson - statistic).} - \item{Khi2L}{only for designs I, test of random resource use - (Log-likelihood statistic).} - \item{Khi2L1}{only for designs II, test of identical use of habitat by all - animals.} - \item{Khi2L2}{only for designs II, test of overall habitat selection.} - \item{Khi2L2MinusL1}{only for designs II, test of hypothesis that animals - are on average using resources in proportion to availability, - irrespective of whether they are the same or not (= Khi2L2 - - Khi2L1).} - \item{wij}{only for designs II and III, a matrix with the selection - ratios for all animals and all resource categories.} - \item{ICwiupper}{only for designs II and III, the upper limit of the - confidence intervals on the selection ratios.} - \item{ICwilower}{only for designs II and III, the lower limit of the - confidence intervals on the selection ratios.} - \item{Khi2Lj}{only for designs III, the test of habitat selection for each - animal.} - \item{Khi2L}{only for designs III, the global test of overall habitat - selection.} -} -\references{ - Manly B.F.J., McDonald L.L., Thomas, D.L., McDonald, T.L. & Erickson, - W.P. (2003) \emph{Resource selection by animals - Statistical design and - Analysis for field studies. Second edition} - London: Kluwer academic publishers. - - Thomas D. L. and Taylor E. J. (1990) Study designs and tests for - comparing resource use and availability. \emph{Journal of Wildlife - Management}, \bold{54}, 322--330. -} -\author{Clément Calenge \email{calenge@biomserv.univ-lyon1.fr}} - -\seealso{\code{\link{compana}} for compositional analysis, and - \code{\link{eisera}} to perform an eigenanalysis of selection - ratios.} - -\examples{ - -############################ -## Example of moose (Manly et al., 2003, p.52) -## Known available proportions on design I data -moose.avail <- c(0.34, 0.101, 0.104, 0.455) -moose.used <- c(25, 22, 30, 40) -names(moose.used) <- c("InBurnInterior", - "InBurnEdge", - "OutOfBurnEdge", - "OutOfBurnFurther") -names(moose.avail) <- names(moose.used) -## Computation of wi -(wiRatio <- widesI(moose.used, moose.avail)) - -## plot the values of the selection ratios -opar <- par(mfrow=c(2,2)) -plot(wiRatio) - -par(opar) - - - - -############################ -## Example of Elk (Manly et al., 2003, p.62) -## Estimated available proportions on design I data -elk.avail <- c(15, 61, 84, 40) -elk.used <- c(3, 90, 181, 51) -names(elk.used) <- c("0\%", "1-25\%", "26-75\%", ">75\%") -names(elk.avail) <- names(elk.used) -## Computation of wi -(wiRatio <- widesI(elk.used, elk.avail, avknown=FALSE)) - -## plot the values of the selection ratios -opar <- par(mfrow=c(2,2)) -plot(wiRatio) - -par(opar) - - - - -############################ -## Example of Bighorn (Manly et al., 2003, p.67) -## Known available proportions on design II data -data(bighorn) -## Computation of wi -(wi <- widesII(bighorn$used, bighorn$availT, alpha = 0.1)) - -## plot the values of the selection ratios -opar <- par(mfrow=c(2,2)) -plot(wi) - - - -############################ -## Example of Bighorn (Manly et al., 2003, p.74) -## Estimated available proportions on design II data -## Computation of wi -(wi <- widesII(bighorn$used, bighorn$availE, avknown = FALSE, alpha = 0.1)) - -## plot the values of the selection ratios -plot(wi) - -par(opar) - - -############################ -## Example of Wild boar -## Estimated available proportions on design III data -data(puechdesIII) -used <- puechdesIII$used -available <- puechdesIII$available - -## calculation of the selectio ratios -## with sampled availability -(i <- widesIII(used,available, avknown = FALSE, alpha = 0.1)) - -opar <- par(mfrow = c(2,2)) -plot(i) - -par(opar) - - -} -\keyword{hplot} -\keyword{math} +\name{wi} +\alias{widesI} +\alias{widesII} +\alias{widesIII} +\alias{print.wiI} +\alias{print.wiII} +\alias{print.wiIII} +\alias{plot.wi} +\alias{wi} +\alias{wiI} +\alias{wiII} +\alias{wiIII} +\title{Computation of Selection Ratios for Habitat Selection Studies.} +\description{ + These functions compute the resource selection ratios (wi) for design I, II + and III data types, with resources defined by several categories. + Basic tests are also provided. +} +\usage{ +widesI(u, a, avknown = TRUE, alpha = 0.05) +widesII(u, a, avknown = TRUE, alpha = 0.05) +widesIII(u, a, avknown = TRUE, alpha = 0.05) +print.wiI(x, \dots) +print.wiII(x, \dots) +print.wiIII(x, \dots) +plot.wi(x, caxis = 0.7, clab = 1, ylog = FALSE, errbar = c("CI", "SE"), + main = "Manly selectivity measure", noorder = TRUE, \dots) +} +\arguments{ + \item{u}{for \code{widesI}, a vector with named elements describing + the sample of used resource units. For \code{widesII} and + \code{widesIII} a matrix or a data frame giving the number of used + resource units for each animal (in rows) in each resource category + (in columns)} + \item{a}{for \code{widesI} and \code{widesII}, a vector with named + elements describing the sample or the proportion of available + resource units. For \code{widesIII} a matrix or a + data frame giving the number or the proportion of available resource + units for each animal (in rows) in each resource category (in + columns)} + \item{avknown}{logical. \code{TRUE} if the available + proportions are known, and \code{FALSE} if they are estimated} + \item{alpha}{the threshold value for the tests and confidence + intervals} + \item{x}{an object of class \code{wi}} + \item{caxis}{character size on axes to be passed to + \code{par("cex.axis")}} + \item{clab}{character size of axes labels to be passed to + \code{par("cex.lab")}} + \item{ylog}{logical. If \code{TRUE}, the selection ratios are plotted + on a log scale} + \item{errbar}{a character string. Type of error bars: either \code{"CI"} + for confidence intervals or \code{"SE"} for standard errors} + \item{main}{a character string. The title of the graph} + \item{noorder}{logical. If \code{TRUE}, the habitat categories are + ordered on the graph in decreasing order of their preference. If + FALSE, they are not ordered (i.e. they are in the same order as the + columns in \code{used} and \code{available}} + \item{\dots}{additionnal arguments to be passed to the function + \code{plot}} +} +\details{ + \code{widesI} may be used to explore resource selection by + animals, when designs I are involved (habitat use and availability are + measured at the population level - animals are not identified). The + function tests habitat selection with the Khi2 of Pearson + and log-likelihood Khi2 (recommended, see Manly et al. 2003). The + Manly selectivity measure (selection ratio = used/available) is + computed, the preference / avoidance is tested for + each habitat, and the differences between selection ratios are computed + and tested. \cr + + \code{widesII} computes the selection ratios with design II + data (same availability for all animals, but use measured for each one). + Tests of identical habitat use for all animals, and of habitat + selection are also provided.\cr + + \code{widesIII} computes the + selection ratios for design III data (when the use and the + availability are measured for each animal - + see examples on the wild boar below). Habitat selection is tested + using a Chi-square for each animal, and the overall habitat selection + is also tested. +} +\value{ + \code{widesI} returns a list of the class \code{wiI}. \code{widesII} + returns a list of class \code{wiII}. \code{widesIII} + returns a list of class \code{wiIII}. These objects are all + inheriting from the class \code{wi}. They have the following components: + \item{used.prop}{the proportion of use for each resource type.} + \item{avail.prop}{the proportion of available resources.} + \item{wi}{the Manly selectivity measure (selection ratio: + used/available).} + \item{se.wi}{the standard error of the selection ratios.} + \item{comparisons}{a list with the following components:\describe{ + \item{\code{diffwi}}{a matrix with the differences of the selection + ratios for each pair of resource type.} + \item{\code{ICdiffupper}}{a matrix containing the upper limit of confidence + interval on the differences of the selection ratios between each + pair of resource type.} + \item{\code{ICdifflower}}{a matrix containing the lower limit of confidence + interval on the differences of the selection ratios between each + pair of resource type.} + \item{\code{signif}}{the ranking matrix, with the sign of the differences + between the resource type in row and the resource type in + column. When the difference is significant, the sign is + tripled.} + } + } + \item{profile}{the profile of preferences: resource types are sorted + so that the left type is the most preferred and the right type is + the most avoided. Habitats for which the selection ratios are not + significant are connected by a line.} + \item{alpha}{the parameter \code{alpha} of this function.} + \item{avknown}{the parameter \code{avknown} of this function.} + \item{se.used}{only for designs I, the standard error of + the proportion of use.} + \item{se.avail}{only for designs I, the standard error of + the available proportion.} + \item{chisquwi}{only for designs I, the results of Chi-Square tests of the + hypothesis that the selection ratios are in average equals to zero.} + \item{Bi}{only for designs I, equals to \code{wi/sum(wi)}.} + \item{Khi2P}{only for designs I, test of random resource use (Pearson + statistic).} + \item{Khi2L}{only for designs I, test of random resource use + (Log-likelihood statistic).} + \item{Khi2L1}{only for designs II, test of identical use of habitat by all + animals.} + \item{Khi2L2}{only for designs II, test of overall habitat selection.} + \item{Khi2L2MinusL1}{only for designs II, test of hypothesis that animals + are on average using resources in proportion to availability, + irrespective of whether they are the same or not (= Khi2L2 - + Khi2L1).} + \item{wij}{only for designs II and III, a matrix with the selection + ratios for all animals and all resource categories.} + \item{ICwiupper}{only for designs II and III, the upper limit of the + confidence intervals on the selection ratios.} + \item{ICwilower}{only for designs II and III, the lower limit of the + confidence intervals on the selection ratios.} + \item{Khi2Lj}{only for designs III, the test of habitat selection for each + animal.} + \item{Khi2L}{only for designs III, the global test of overall habitat + selection.} +} +\references{ + Manly B.F.J., McDonald L.L., Thomas, D.L., McDonald, T.L. & Erickson, + W.P. (2003) \emph{Resource selection by animals - Statistical design and + Analysis for field studies. Second edition} + London: Kluwer academic publishers. + + Thomas D. L. and Taylor E. J. (1990) Study designs and tests for + comparing resource use and availability. \emph{Journal of Wildlife + Management}, \bold{54}, 322--330. +} +\author{Clément Calenge \email{calenge@biomserv.univ-lyon1.fr}} + +\seealso{\code{\link{compana}} for compositional analysis, and + \code{\link{eisera}} to perform an eigenanalysis of selection + ratios.} + +\examples{ + +############################ +## Example of moose (Manly et al., 2003, p.52) +## Known available proportions on design I data +moose.avail <- c(0.34, 0.101, 0.104, 0.455) +moose.used <- c(25, 22, 30, 40) +names(moose.used) <- c("InBurnInterior", + "InBurnEdge", + "OutOfBurnEdge", + "OutOfBurnFurther") +names(moose.avail) <- names(moose.used) +## Computation of wi +(wiRatio <- widesI(moose.used, moose.avail)) + +## plot the values of the selection ratios +opar <- par(mfrow=c(2,2)) +plot(wiRatio) + +par(opar) + + + + +############################ +## Example of Elk (Manly et al., 2003, p.62) +## Estimated available proportions on design I data +elk.avail <- c(15, 61, 84, 40) +elk.used <- c(3, 90, 181, 51) +names(elk.used) <- c("0\%", "1-25\%", "26-75\%", ">75\%") +names(elk.avail) <- names(elk.used) +## Computation of wi +(wiRatio <- widesI(elk.used, elk.avail, avknown=FALSE)) + +## plot the values of the selection ratios +opar <- par(mfrow=c(2,2)) +plot(wiRatio) + +par(opar) + + + + +############################ +## Example of Bighorn (Manly et al., 2003, p.67) +## Known available proportions on design II data +data(bighorn) +## Computation of wi +(wi <- widesII(bighorn$used, bighorn$availT, alpha = 0.1)) + +## plot the values of the selection ratios +opar <- par(mfrow=c(2,2)) +plot(wi) + + + +############################ +## Example of Bighorn (Manly et al., 2003, p.74) +## Estimated available proportions on design II data +## Computation of wi +(wi <- widesII(bighorn$used, bighorn$availE, avknown = FALSE, alpha = 0.1)) + +## plot the values of the selection ratios +plot(wi) + +par(opar) + + +############################ +## Example of Wild boar +## Estimated available proportions on design III data +data(puechdesIII) +used <- puechdesIII$used +available <- puechdesIII$available + +## calculation of the selectio ratios +## with sampled availability +(i <- widesIII(used,available, avknown = FALSE, alpha = 0.1)) + +opar <- par(mfrow = c(2,2)) +plot(i) + +par(opar) + + +} +\keyword{hplot} +\keyword{math} diff --git a/src/tests.c b/src/tests.c index f391a9a..8aac834 100755 --- a/src/tests.c +++ b/src/tests.c @@ -1571,7 +1571,7 @@ void sahr2ksel(double *Usa, double *Uhr, double *Ulo, int *nhab, /* Calculs */ /* Calcul du nombre de lignes du tableau de sortie */ for (i=1; i<=np; i++) { - if (SA[i][1] != -9999) { + if (fabs(SA[i][1] + 9999) > 0.000000001) { idna[i] = 1; /* = 1 si non NA */ } } @@ -1581,7 +1581,7 @@ void sahr2ksel(double *Usa, double *Uhr, double *Ulo, int *nhab, for (i=1; i<=np; i++) { for (j=1; j<=na; j++) { - if ((idna[i]==1)&&(HR[i][j]==1)) { + if ((idna[i]==1)&&(((int) HR[i][j])==1)) { l++; for (k=1; k<=nh; k++) { sortie[l][k] = SA[i][k]; /* Que l'on passera à dud après */ @@ -1663,7 +1663,7 @@ void nls2k(double *Usa, double *Uhr, int *nhab, /* Calculs */ /* Calcul du nombre de lignes du tableau de sortie */ for (i=1; i<=np; i++) { - if (SA[i][1] == -9999) { + if (fabs(SA[i][1] + 9999) < 0.000000001) { idna[i] = 0; /* = 1 si non NA */ } } @@ -1676,7 +1676,7 @@ void nls2k(double *Usa, double *Uhr, int *nhab, for (i=1; i<=np; i++) { if (idna[i] == 1) { for (j=1; j<=na; j++) { - if (HR[i][j]==1) { + if (((int) HR[i][j]) == 1) { ni[j] = ni[j]+1; } } @@ -1805,7 +1805,7 @@ void shifthr(double **dispo, double **util, int *idl, int *idc) for (i=1; i<=nlpe; i++) { for (j=1; j<=ncpe; j++) { if (util[i][j]>0) { - if (dispo[i+lrand-1][j+crand-1]==-9999) { + if (fabs(dispo[i+lrand-1][j+crand-1] + 9999) < 0.000000001) { l=0; } } @@ -2161,7 +2161,7 @@ void comptePasNA(double **tab, int *nombre) nl = tab[0][0]; for (i=1; i<=nl; i++) { - if (tab[i][1]!=-9999) { + if (fabs(tab[i][1] + 9999) > 0.000000001) { nb++; } } @@ -2187,7 +2187,7 @@ void videNA(double **entree, double **sortie, int *idcons) k=1; for (i=1; i<=nl; i++) { - if (entree[i][1]!=-9999) { + if (fabs(entree[i][1] + 9999) > 0.000000001) { idcons[k] = i; for (j=1; j<=nc; j++) { sortie[k][j] = entree[i][j]; @@ -2572,7 +2572,7 @@ void levels(double *vec, double *lev, int *lvec) for (i=2; i<=n; i++) { l=0; for (j=1; j<=k; j++) { - if (vec[i]==lev[j]) + if (fabs(vec[i] - lev[j]) < 0.000000001) l=1; } if (l==0) { @@ -2674,7 +2674,7 @@ void seqeticorr(double *grille, int *nlig, int *ncol) vecalloc(&etcons, m-1); n=1; for (l=1; l<=m; l++) { - if (x[i][j] != tmp2[l]) { + if (fabs(x[i][j] - tmp2[l]) > 0.000000001) { etcons[n] = tmp2[l]; n++; } @@ -2732,7 +2732,7 @@ void seqeticorr(double *grille, int *nlig, int *ncol) /* Deuxième passage */ for (i=1; i<=nl; i++) { for (j=1; j<=nc; j++) { - if (x[i][j]!=0) { + if (fabs(x[i][j]) > 0.000000001) { x[i][j] = Tc[(int) x[i][j]]; } } @@ -3253,7 +3253,7 @@ void wml(double **used, double **avail, double *wmla, int na, int nh, vecalea[i] = aleamu[1]; } - /* cas où krep ==1 : première répétition de la + /* cas où krep == 1 : première répétition de la randomisation: on calcule le "vrai" lambda (pas randomisé) */ if (krep == 1) { @@ -3291,7 +3291,7 @@ void wml(double **used, double **avail, double *wmla, int na, int nh, jb = vecindice[j]; idcol = (nh - 1) * (k - 1) + j; for (i = 1; i <= na; i++) { - if ((avail[i][jb]!=0)&&(avail[i][k]!=0)) { + if ((fabs(avail[i][jb]) > 0.000000001)&&(fabs(avail[i][k]) > 0.000000001)) { dlr[i][idcol] = (log(used[i][jb] / used[i][k]) - log(avail[i][jb] / avail[i][k])) * vecalea[i]; @@ -3311,7 +3311,7 @@ void wml(double **used, double **avail, double *wmla, int na, int nh, idcol = (nh - 1) * (k - 1) + j; jb = vecindice[j]; for (i = 1; i <= na; i++) { - if ((avail[i][jb]==0)||(avail[i][k]==0)) + if ( (fabs(avail[i][jb]) < 0.000000001)||(fabs(avail[i][k])< 0.000000001)) dlr[i][idcol] = moydlr[j]; } } @@ -3410,7 +3410,7 @@ void aclambda(double *util, double *dispo, int *nani, int *nhab, for (i = 1; i <= na; i++) { for (j = 1; j <= nh; j++) { ut[i][j] = util[k]; - if (ut[i][j] == 0) + if (fabs(ut[i][j]) < 0.000000001) ut[i][j] = *rnv; k++; } @@ -3512,7 +3512,7 @@ void rankma(double *used, double *avail, double *rankmap, double *rankmam, for (j = 1; j <= nh; j++) { u[i][j] = used[k]; a[i][j] = avail[k]; - if (u[i][j] == 0) + if (fabs(u[i][j]) < 0.000000001) u[i][j] = *rnv; k++; } @@ -3536,7 +3536,7 @@ void rankma(double *used, double *avail, double *rankmap, double *rankmam, moy = 0; /* premier remplissage des dlr par ani */ for (i = 1; i <= na; i++) { - if ((a[i][j]!=0)&&(a[i][k]!=0)) { + if ((fabs(a[i][j])> 0.000000001)&&(fabs(a[i][k]) > 0.000000001)) { dlrtmp[i] = (log(u[i][j]/u[i][k]) - log(a[i][j]/a[i][k])) * tabani[r][i]; moy = moy + dlrtmp[i]; if (r == 1) @@ -3635,7 +3635,7 @@ void erodil(double *grille, int *nlig, int *ncol, int *ntour, int *oper) voisin[8] = x[i+1][j+1]; voisin[9] = x[i][j]; for (l=1;l<=9; l++) { - if (voisin[l]==0) { + if (((int) voisin[l])==0) { etat0 = etat0 + 1; } else { etat1 = etat1 + 1; @@ -3725,13 +3725,13 @@ void inout(double *x, double *y, double *xp, double *yp, if (sig < 0) { /* calcul de la pente et ord ori */ /* Cas 1: on n'a pas de pente infinie */ - if ((xpc[i+1] - xpc[i])!=0) + if (fabs(xpc[i+1] - xpc[i]) > 0.000000001) { a = (ypc[i+1] - ypc[i]) / (xpc[i+1] - xpc[i]); b = (ypc[i]- a * xpc[i]); /* calcul de x à y = 0 */ /* ayant un sens seulement si a != 0 */ - if (((ypc[i+1] - ypc[i])!=0)) { + if ((fabs(ypc[i+1] - ypc[i]) > 0.000000001)) { x0 = - b / a; if (x0 >= 0) wm = abs(wm - 1); @@ -3740,7 +3740,7 @@ void inout(double *x, double *y, double *xp, double *yp, /* Cas 2: On a une pente infinie il faut alors vérifier que à droite du point, soit xi >0 */ - if (((xpc[i+1] - xpc[i])==0)) + if ((fabs(xpc[i+1] - xpc[i]) < 0.000000001)) { if (xpc[i] >= 0) wm = abs(wm - 1); @@ -3967,8 +3967,8 @@ void calcniche(double **kasc, int *nvar, int *nlg, int *ncg, /* calcul de la moyenne utilisée */ for (i = 1; i <= nl; i++) { for (j = 1; j <= nc; j++) { - if (carte[i][j] == 1) { - if (cartevar[i][j] != -9999) { + if (fabs(carte[i][j] - 1) < 0.000000001) { + if (fabs(cartevar[i][j] + 9999) > 0.000000001) { margvar[l] = margvar[l] + cartevar[i][j]; npixpol++; } @@ -3980,8 +3980,8 @@ void calcniche(double **kasc, int *nvar, int *nlg, int *ncg, /* Calcul de la tolérance */ for (i = 1; i <= nl; i++) { for (j = 1; j <= nc; j++) { - if (carte[i][j] == 1) { - if (cartevar[i][j]!=-9999) { + if (fabs(carte[i][j] - 1) < 0.000000001) { + if (fabs(cartevar[i][j] + 9999) > 0.000000001) { tolvar[l] = tolvar[l] + (cartevar[i][j] - margvar[l])*(cartevar[i][j] - margvar[l]); } } @@ -4296,7 +4296,7 @@ void rpath(double **xp, double *rcx, double *rcy, double **asc, /* Vérifie que la loc tombe bien dans la zone d'étude */ dedans(pts, xc, yc, &na, *cs, asc); - if (na != -9999) + if (fabs(na + 9999) > 0.000000001) k = 1; } @@ -4309,7 +4309,7 @@ void rpath(double **xp, double *rcx, double *rcy, double **asc, /* combien y-a-t-il de distances pour l'intervalle observé ? */ nsam = 0; for (j = 1; j <= nltd; j++) { - if (tabdist[j][1]==interv) + if (fabs(tabdist[j][1] - interv) < 0.000000001) nsam++; } @@ -4326,7 +4326,7 @@ void rpath(double **xp, double *rcx, double *rcy, double **asc, on récupère les distances correspondantes */ m = 1; for (j = 1; j <= nltd; j++) { - if (tabdist[j][1]==interv) { + if (fabs(tabdist[j][1] - interv) < 0.000000001) { dobs[m] = tabdist[j][2]; m++; } @@ -4354,7 +4354,7 @@ void rpath(double **xp, double *rcx, double *rcy, double **asc, pts[2] = xp[i+1][2]; dedans(pts, xc, yc, &na, *cs, asc); - if (na != -9999) + if (fabs(na + 9999) > 0.000000001) k = 1; } freevec(dobs); @@ -4780,7 +4780,7 @@ void rpoint(double **xp, double *rcx, double *rcy, double **asc, /* Vérifie que la loc tombe bien dans la zone d'étude */ dedans(pts, xc, yc, &na, *cs, asc); - if (na != -9999) + if (fabs(na + 9999) > 0.000000001) k = 1; } @@ -4997,9 +4997,9 @@ void regroufacasc(double **asce, double **ascs, int *np, na = 0; for (k = dr; k <= fr; k++) { for (l = dc; l <= fc; l++) { - if (asce[k][l] != -9999) + if (fabs(asce[k][l] + 9999) > 0.000000001) ll[(int) asce[k][l]]++; - if (asce[k][l] == -9999) + if (fabs(asce[k][l] + 9999) < 0.000000001) na++; } } @@ -5113,17 +5113,20 @@ void regrouascnum(double **ascent, double **ascso) for (k = 1; k <= nreg; k++) { for (l = 1; l <= nreg; l++) { tmp = ascent[((i - 1) * nreg) + k][((j - 1) * nreg) + l]; - if (tmp != -9999) { + if (fabs(tmp + 9999) > 0.000000001) { moy = tmp + moy; } - if (tmp == -9999) { + if (fabs(tmp + 9999) < 0.000000001) { n++; } } } - ascso[i][j] = moy / ((double) (nreg * nreg)); - if (n == (nreg * nreg)) + if (n == (nreg * nreg)) { ascso[i][j] = -9999; + } else { + ascso[i][j] = moy / (((double) (nreg * nreg))- ((double) n)); + + } } }