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: gxgy.to.quad
Function Description: gxgy.to.quad
Calculate a quadrat name (column number then row number, as a 4-digit character string) from gy-gy.Function Arguments:
| Argument | Default Value |
|---|---|
| gx | |
| gy | |
| gridsize | 20 |
| plotdim | c(1000,500) |
| digits | 2 |
Function Source:
gxgy.to.quad=function(gx,gy,gridsize=20,plotdim=c(1000,500),digits=2)
{
rc=gxgy.to.rowcol(gx,gy,gridsize,plotdim)
if(digits!=2) return("Must rewrite if three digit quadrats")
lowrow=which(rc$row<10 & rc$row>(-1))
rowstr=as.character(rc$row)
rowstr[lowrow]=pst("0",rowstr[lowrow])
lowcol=which(rc$col<10 & rc$col>(-1))
colstr=as.character(rc$col)
colstr[lowcol]=pst("0",colstr[lowcol])
return(pst(colstr,rowstr))
}
{
rc=gxgy.to.rowcol(gx,gy,gridsize,plotdim)
if(digits!=2) return("Must rewrite if three digit quadrats")
lowrow=which(rc$row<10 & rc$row>(-1))
rowstr=as.character(rc$row)
rowstr[lowrow]=pst("0",rowstr[lowrow])
lowcol=which(rc$col<10 & rc$col>(-1))
colstr=as.character(rc$col)
colstr[lowcol]=pst("0",colstr[lowcol])
return(pst(colstr,rowstr))
}