Description Usage Arguments Value Examples
This function returns the allocations for each demand point - in terms of the index number of
the record in swdf2
assigned as the supply point. This version is useful as part of
code inside other functions
1 |
swdf1 |
- first Spatial* or Spatial*DataFrame objects |
swdf2 |
- second Spatial* or Spatial*DataFrame objects (if omitted, defaults to the same value as |
force |
- list of supply points or logical vector with length the same as the number of supply points that are forced to be used - eg existing outlets |
p |
- either a guess at the initial p-median set of a single integer indicating the size of the set (which is then chosen randomly) |
metric |
- the distance matrix (defaults to Euclidean computed via |
verbose |
- if TRUE print out each swap in the algorithm (default is FALSE) |
List of nearest neigbour indices for each element from the p-median set
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | data(meuse)
coordinates(meuse) <- ~x+y
allocate(meuse,p=5)
require(RColorBrewer)
require(GISTools)
data(georgia)
allocations.list <- allocate(georgia2,p=5)
zones <- gUnaryUnion(georgia2,allocations.list)
plot(zones,col=brewer.pal(5,"Accent"))
plot(georgia2,border=rgb(0,0,0,0.1),add=TRUE)
points(coordinates(georgia2)[allocations.list,],pch=16,cex=2,col=rgb(1,0.5,0.5,0.1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.