Learn R Programming

geozoning (version 1.0.0)

saveZK: saveZK function called by correctionTree

Description

saveZK function called by correctionTree

Usage

saveZK(map, K1, Z2, qProb, listOfZ, indCur, crit, cost, costL, nz, mdist,
  pErr = 0.9, optiCrit = 2, simplitol = 0.001)

Arguments

map

object returned by function genMap

K1

previous zoning

Z2

current zoning geometry (list of SpatialPolygons)

qProb

probability vector used to generate quantile values

listOfZ

list of zoning objects

indCur

index of new list element

crit

list of criteria

cost

list of costs

costL

list of per label costs

nz

list of number of zones

mdist

list of distance matrices

pErr

equality tolerance for distance calculations

optiCrit

criterion choice

simplitol

tolerance for spatial polygons geometry simplification

Value

a list with components

listOfZ

updated list of zoning objects, first element corresponds to initial zoning, each other element is a list with each (last if ALL=FALSE) level zoning objects

mdist

list of initial distance matrix and all (last if ALL=FALSE) level distance matrices

crit

list of initial criterion and all (last if ALL=FALSE) level criteria

cost

list of initial cost and all (last if ALL=FALSE) level costs

costL

list of initial cost per label and all (last if ALL=FALSE) level costs per label

nz

list of initial number of zones and all (last if ALL=FALSE) level number of zones

Details

Given a map object, a list of zonings, a current and a previous zoning, adds the current zoning to the list of zonings if it has at least 2 zones,after recalculating zone neighborhood and transferring zone labels.

Examples

Run this code
# NOT RUN {
data(mapTest)
# run zoning with 2 quantiles corresponding to probability values 0.4 and 0.7
criti=correctionTree(c(0.4,0.7),mapTest,LASTPASS=FALSE,SAVE=TRUE)
K1=criti$zk[[1]][[1]]#initial zoning
Z1=K1$zonePolygone
printZsurf(Z1) # 8 zones with 2 small zones (7 and 8)
Z2 = geozoning:::remove1FromZ(Z1,7,K1$zoneN)
printZsurf(Z2) #7 zones
indCur=2
newRes=geozoning:::saveZK(mapTest,K1,Z2,c(0.4,0.7),criti$zk,indCur,
        criti$criterion,criti$cost,criti$costL,criti$nz,criti$mdist)
newZ=newRes$listOfZ[[2]][[1]]$zonePolygone
printZsurf(newZ) #6 zones
# }

Run the code above in your browser using DataLab