Learn R Programming

geozoning (version 1.0.0)

calNei: calNei calculate zone neighborhood and assign data points to zones

Description

calNei calculate zone neighborhood and assign data points to zones

Usage

calNei(Z, spdata, surfVoronoi, ptN, simplitol = 0.001, remove = TRUE,
  correct = FALSE, nmin = 2)

Arguments

Z

zoning geometry (list of SpatialPolygons)

spdata

SpatialPointsDataFrame containing the data pts and values

surfVoronoi

Surfaces of the Voronoi polygons corresponding to data pts

ptN

indices of data pts neighbours

simplitol

tolerance for spatial polygons geometry simplification

remove

if TRUE remove zones with less than nmin data points

correct

if TRUE correct zone neighborhood

nmin

number of points below wich a zone is removed from the zoning (default is 2)

Value

a list with components

zoneN

matrix of zone neigbors

zoneNModif

modified matrix with FALSE on the diagonal

listZonePoint

indices of pts within each zone

meanTot

zoning mean data value

meanZone

vector of zone data mean values

listSurf

vector of zone areas

critSurf

vector of filiform zone characteristics

zonePolygone

list of zones, each zone is a SpatialPolygons

Details

calNei first removes from zoning Z all zones with less than a minimum number of points. Then it calculates zone neighborhood, assigns each data point to a zone, computes zone mean values and areas. It does not assign zone labels (this is done by labZone function for the initial zoning, and by trLabZone function to transfer labels to corrected zonings).

Examples

Run this code
# NOT RUN {
data(mapTest)
ptN=mapTest$krigN
spdata=mapTest$krigData
surfVoronoi=mapTest$surfVoronoi
data(resZTest)
Z=resZTest$zonePolygone
K=calNei(Z,spdata,surfVoronoi,ptN)
names(K)
plotZ(K$zonePolygone)
K=calNei(Z,spdata,surfVoronoi,ptN,nmin=20) #keep only zones with a minimum of 20 data points
plotZ(K$zonePolygone)
# }

Run the code above in your browser using DataLab