Topic: Spatial

Topic Description:

Functions for calculating Ripley's K from CTFS R Analytical Tables, many routines for quadrat-based calculations. and calculations of wavelet variance.



File: spatial/NeighborDensityFun.r

View File Source Download File No help file available

Function: NDcount

Function Description: NDcount

Calculates the count of neighbors within radius r with edge effect correction. Is a quick version of NeighborDensities with limited capabilities.
Dependencies: CalcRingArea from the CTFS package and splancs.
Output: a single vector with neighbor counts within radius r for each individual in censdata.
Author: Tania Brenes

Function Arguments:

ArgumentDefault Value
censdata
r20
plotdimc(1000,500)

Arguments Description:

  • censdata: Is the coordinates dataset, should have the coordinates (gx, gy)
  • r (20): radius
  • plotdim (c(1000,500)): vector with two numbers indicating the xy-plot size;


Sample Usage:

count all the consp neighbors of one species
> one.sp = subset(bci.full7, sp=="ingasa" & status=="A")
> neighbor.counts <- NDcount(one.sp)


Function Source:

NDcount=function(censdata, r=20, plotdim=c(1000,500))
{

sppi.pts <- with(censdata, data.frame(gx,gy))
areas <- CalcRingArea(sppi.pts, r, plotdim)$each

poly=spoints(c(0,0,plotdim[1],0,plotdim[1],plotdim[2],0,plotdim[2]))
counts <- khat(sppi.pts, poly=poly,r, newstyle=TRUE)$counts
output = counts * pi * r^2 /areas

return(as.vector(output))
}