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/quadfunc.r

View File Source Download File No help file available

Function: torus.shift

Function Description: torus.shift

Creates a torus-shifted quadrat topographic dataset. It accepts a quadrat dataset with elevation, convexity, and slope for each 20x20 m quadrat in a plot. It returns a parallel dataset that is torus shifted, slip.horiz quadrats left-right and slip.vert quadrats up-down. That is, in the new dataset, the topographic information of each quadrat comes from a quadrat displaced by slip.horiz and slip.vert units away in the original dataset.

Function Arguments:

ArgumentDefault Value
quaddata
slip.horiz
slip.vert
invertF
reverseF
plotdimc(1000,500)
gridsize20

Function Source:


torus.shift=function(quaddata,slip.horiz,slip.vert,invert=F,reverse=F,plotdim=c(1000,500),gridsize=2
        0) {
rows=plotdim[2]/gridsize
columns=plotdim[1]/gridsize
totalquad=rows*columns

q20=index.to.rowcol(1:totalquad,plotdim=plotdim,gridsize=gridsize)

newq20=q20

newq20$row=q20$row-slip.vert
below=newq20$row<=0
newq20$row[below]=newq20$row[below]+rows
above=newq20$row>rows
newq20$row[above]=newq20$row[above]-rows

newq20$col=q20$col-slip.horiz
below=newq20$col<=0
newq20$col[below]=newq20$col[below]+columns
above=newq20$col>columns
newq20$col[above]=newq20$col[above]-columns

newindex=rowcol.to.index(newq20$row,newq20$col,plotdim=plotdim,gridsize=gridsize)
ord=order(newindex)
newquaddata=quaddata[ord,]
rownames(newquaddata)=1:totalquad
return(newquaddata)
}