Last data update: 2014.03.03

R: Plot the random points and the corresponding association...
fAssocplotR Documentation

Plot the random points and the corresponding association matrix

Description

This function plots the output data spatially, allowing the user to visualise the random locations generated for individuals and the resulting associations defined by group memberships. This map can be plotted with or without individual ID labels.

Usage

fAssocplot(dnndata, idataxy, iplotnames = FALSE)

Arguments

dnndata

a nb type object

idataxy

A SpatialPointsDataframe object containing the random locatons of the animals

iplotnames

logical. Whether or not the user wants the animal IDs printed on the association plot. Default = FALSE

Author(s)

Ross Dwyer ross.dwyer@uq.edu.au

See Also

fAssoctable, fAssocmatrix, dnearneigh

Examples


## Load required packages
library(adehabitatHR)

## Load the data
data(StudyArea)
data(Roos)

## Convert into a spatial object
coordinates(Roos) <- ~x+y

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

## For all 10 individuals, extract probability weighted random points 
## falling within their respective utilisation distributions
ranXY <- fRanXY(1:10,udsgdf)
coordinates(ranXY) <- ~x+y

## Run Nearest neighbour function with those interactions < 50 m to generate the nb object
## See ?dnearneigh in the spdep package for more information
Gprox <- 50
dnn_digi <- dnearneigh(ranXY,0,Gprox,row.names=as.character(ranXY$ID))

## Plot and visualise these groups with and without animal IDS
fAssocplot(dnn_digi,ranXY,iplotnames=TRUE)
fAssocplot(dnn_digi,ranXY,iplotnames=FALSE)

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/fAssocplot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: fAssocplot
> ### Title: Plot the random points and the corresponding association matrix
> ### Aliases: fAssocplot
> 
> ### ** 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 the data
> data(StudyArea)
> data(Roos)
> 
> ## Convert into a spatial object
> coordinates(Roos) <- ~x+y
> 
> ## Estimation of UD and KUD 95% for the 10 animals
> ud <- kernelUD(Roos,h="href",same4all=TRUE)
> ver95 <- getverticeshr(ud,95,unin = c("m"),unout=c("ha"))
> udsgdf <- as(estUDm2spixdf(ud),"SpatialGridDataFrame")
> 
> ## For all 10 individuals, extract probability weighted random points 
> ## falling within their respective utilisation distributions
> ranXY <- fRanXY(1:10,udsgdf)
> coordinates(ranXY) <- ~x+y
> 
> ## Run Nearest neighbour function with those interactions < 50 m to generate the nb object
> ## See ?dnearneigh in the spdep package for more information
> Gprox <- 50
> dnn_digi <- dnearneigh(ranXY,0,Gprox,row.names=as.character(ranXY$ID))
> 
> ## Plot and visualise these groups with and without animal IDS
> fAssocplot(dnn_digi,ranXY,iplotnames=TRUE)
> fAssocplot(dnn_digi,ranXY,iplotnames=FALSE)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>