boundary: Checking boundary parameters vor plotting of 'lmap'

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/boundary.R

Description

The function lmap can be tweaked by various parameters determining the boundary of the interplolation. The function boundary helps finding suitable parameters.

Usage

1
2
boundary(points, density = 0.02, grid = 10, box.offset = 0.1
  , tightness = "auto", manual = NULL, plot = TRUE)

Arguments

points

Points, typically a two-column matrix with x and y coordinates.

density

Density of points below which there should be no interpolation.

grid

Density of the grid.

box.offset

Distance of the box around the points.

tightness

Parameter influencing how tightly the boundary should be wrapped around the points. Passed internally to kde2d. When "auto" this defaults to bandwidth.nrd. Lower values will result in tighter boundaries.

manual

Manually added boundary points in the form of a two-column matrix with coordinates.

plot

Logical: by default the impact of the chosen parameters is shown. If FALSE then coordinates are returned that are the outside of the boundary.

Details

Instead of trying to use a polygon as a boundary for the interpolation internally in lmap it turned out to be easier to use a collection of points that mark th

Value

By default, returns a plot with the original points in black, the points below density in red, and the box around the points in blue. Contour lines of the density are shown to choose different density parameters.

When plot = FALSE, the blue and red points from the graphic are returned as a two-column matrix of x and y coordinates.

Author(s)

Michael Cysouw <cysouw@mac.com>

See Also

Used internally in lmap. The parameters of this function can be passed through, typically density and box.offset.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(hessen)

# show impact of the chosen parameters
boundary(hessen$villages, density = 0.1, grid = 20
  , manual = cbind(x = c(8.3, 9.2), y = c(49.9, 50.0)))

# return coordinates
boundary(hessen$villages, plot = FALSE)

# abstract example, showing tightness in action
p <- cbind(c(1:10, 1:10), c(1:10, 10:1))
par(mfrow = c(1,3))
boundary(p, density = 0.005, grid = 20, tightness = "auto")
boundary(p, density = 0.005, grid = 20, tightness = 5)
boundary(p, density = 0.005, grid = 20, tightness = 3)
par(mfrow = c(1,1))

qlcVisualize documentation built on May 29, 2017, 9:35 p.m.