DirichletPolygons: Dirichlet Polygons

Description Usage Arguments Examples

View source: R/DirichletPolygons.R

Description

Computes the Dirichlet polygons using a SpatialPointsBreeding object and optionally a boundary SpatialPolygons or a vector containing id-s located at the boundary.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
DirichletPolygons(x, boundary, ...)

## S4 method for signature 'SpatialPointsBreeding,missing'
DirichletPolygons(x, boundary, ...)

## S4 method for signature 'SpatialPointsBreeding,integer'
DirichletPolygons(x, boundary, width)

## S4 method for signature 'SpatialPointsBreeding,SpatialPolygons'
DirichletPolygons(x, boundary)

Arguments

x

A SpatialPointsBreeding object.

boundary

A SpatialPolygons or a vector of integers containing the id-s located at the boundary. When missing boundary is inferred using ripras in spatstat .

...

passed to ripras

width

argument passed to gBuffer. It defines the distance between boundary boxes and the boundary polygon; it is set by default to half of the average distance between boundary boxes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
d = data.frame(
  x = c(4, 17, 16, 41, 41, 43, 86, 62, 71, 92, 95,53, 34, 27, 53), 
  y = c(3, 18, 36, 6, 18, 50, 3, 21, 40, 43, 57, 62, 62, 45, 37), 
  id = 1:15,male = paste0('m', 1:15), female = paste0('f', 1:15), 
    stringsAsFactors=FALSE)

b = SpatialPointsBreeding(d, id = 'id', breeding = ~ male + female)  

# boundary is inferred based on the Ripley-Rasson estimate of the spatial domain
dp1 = DirichletPolygons(b)
plot(dp1)

# boundary is given
brdy2 = rgeos::readWKT("POLYGON((28 71,67 68,70 49,84 49,90 74,111 65,107 
                      36,78 28,98 15,98 -4,74 -7,-2 -8,0 31,28 71) )")
dp2 = DirichletPolygons(b, boundary = brdy2)
plot(dp2)

# boundary is inferred based on the boundary id-s. 
# define boundary id-s using a 'Follow-The-Dots' strategy. 
brdy3 = as.integer(c(1, 2, 4, 7, 9, 10, 11, 12, 13, 14, 3))

dp3 = DirichletPolygons(b, boundary = brdy3)
plot(dp3)

# setting width manually
dp4 = DirichletPolygons(b, boundary = brdy3, width = 2)
plot(dp4)


plot(dp1)
plot(dp2, add = TRUE, border = 2)
plot(dp3, add = TRUE, border = 3)
plot(dp4, add = TRUE, border = 4)
plot(b, add = TRUE)

expp documentation built on July 2, 2018, 5:02 p.m.