Last data update: 2014.03.03

R: Plot the location of the random point falling within an...
fDrawfigureR Documentation

Plot the location of the random point falling within an individual's home range

Description

fDrawfigure extracts either a random point or a probability weighted random point falling within a specified home range. The random point, the observed locations, the specified ud vertice or the utilisation distribution can be plotted on a user-defined background.

Usage

fDrawfigure(x, iextract, idataxy = NULL, istudy = NULL)

Arguments

x

a numeric vector representing the individual to be plotted. This number relates to order in which animals are listed within the iextract object

iextract

either a SpatialPolygonsDataFrame object containing the vertice of interest or a SpatialGridDataFrame object containing the utilisation distribution of interest

idataxy

an optional dataframe containing the animal locations

istudy

optional background layer for the points to be plotted. This can be a spatial polygon object, a raster or blank = NULL

Author(s)

Ross Dwyer ross.dwyer@uq.edu.au

Examples


## Load required packages
library(adehabitatHR)

## Load study data
data(StudyArea)
data(Roos)

# Subset the data for only 1 individual
RooSubid <- 'Stripes'
RooSub <- subset(Roos,Roos$ID==RooSubid)
RooSub$ID <- as.character(RooSub$ID)

coordinates(RooSub) <- ~x+y

## Estimation of UD and KUD 95% for 1 animal
ud <- kernelUD(RooSub,h="href",same4all=TRUE)
ver95 <- getverticeshr(ud,95,unin = c("m"),unout=c("ha"))
udsgdf <- as(estUDm2spixdf(ud),"SpatialGridDataFrame")

## Extract random points falling within animal #1's KUD 95%
fDrawfigure(1,ver95,RooSub,StudyArea) 

## Extract probability-weighted random points falling within 
## animal #1's UD and draw on map of the study area. 
fDrawfigure(1,udsgdf,RooSub,StudyArea)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Digiroo2)
Loading required package: maptools
Loading required package: sp
Checking rgeos availability: TRUE
Loading required package: spatstat
Loading required package: nlme
Loading required package: rpart

spatstat 1.45-2       (nickname: 'Caretaker Mode') 
For an introduction to spatstat, type 'beginner' 

Loading required package: spdep
Loading required package: Matrix
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Digiroo2/fDrawfigure.Rd_%03d_medium.png", width=480, height=480)
> ### Name: fDrawfigure
> ### Title: Plot the location of the random point falling within an
> ###   individual's home range
> ### Aliases: fDrawfigure
> 
> ### ** Examples
> 
> 
> ## Load required packages
> library(adehabitatHR)
Loading required package: deldir
deldir 0.1-12
Loading required package: ade4

Attaching package: 'ade4'

The following object is masked from 'package:spdep':

    mstree

The following object is masked from 'package:spatstat':

    disc

Loading required package: adehabitatMA
Loading required package: adehabitatLT
Loading required package: CircStats
Loading required package: MASS

Attaching package: 'MASS'

The following object is masked from 'package:spatstat':

    area

Loading required package: boot

Attaching package: 'boot'

The following object is masked from 'package:spatstat':

    envelope

> 
> ## Load study data
> data(StudyArea)
> data(Roos)
> 
> # Subset the data for only 1 individual
> RooSubid <- 'Stripes'
> RooSub <- subset(Roos,Roos$ID==RooSubid)
> RooSub$ID <- as.character(RooSub$ID)
> 
> coordinates(RooSub) <- ~x+y
> 
> ## Estimation of UD and KUD 95% for 1 animal
> ud <- kernelUD(RooSub,h="href",same4all=TRUE)
> ver95 <- getverticeshr(ud,95,unin = c("m"),unout=c("ha"))
> udsgdf <- as(estUDm2spixdf(ud),"SpatialGridDataFrame")
> 
> ## Extract random points falling within animal #1's KUD 95%
> fDrawfigure(1,ver95,RooSub,StudyArea) 
> 
> ## Extract probability-weighted random points falling within 
> ## animal #1's UD and draw on map of the study area. 
> fDrawfigure(1,udsgdf,RooSub,StudyArea)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>