createxymap: Create map objects for some points and a given distance

Description Usage Arguments Value Author(s) See Also Examples

View source: R/createxymap.R

Description

Creates a map object from a list of coordinates by treating observations within a certain distance as neighbors. The resulting neighborhood structure is stored in a map object in graph format while a map in boundary format is created to enable visualisation.

Usage

1
createxymap(x, y, districts=NULL, p=2, max.dist)

Arguments

x

Vector of x-coordinates of underlying points

y

Vector of y-coordinates of underlying points

districts

Either NULL or a vector of names for labeling points. If districts=NULL, points are labelled by index.

p

Any p-norm with p>=1 can be chosen as the distance measure with the Euclidian distance (p=2) being the default. For p=Inf, the maximum of coordinates is used. Except for p=Inf, calculations can fail for huge p.

max.dist

Value which determines the neighborship. Points whose distance is smaller or equal than max.dist are considered as neighbors.

Value

List of two elements: map object in graph format and map object in boundary format.

Author(s)

Felix Heinzl, Thomas Kneib

See Also

read.gra,read.bnd,drawmap

Examples

1
2
3
4
5
x <- c(3,3,5,9.5,11,11)
y <- c(2,4,4,6,4.5,5)
xymap <- createxymap(x, y, districts=c("A","B","C","D","E","F"), max.dist=2)
xymap$gra
drawmap(map=xymap$bnd)

Example output

Loading required package: shapefiles
Loading required package: foreign

Attaching package: 'shapefiles'

The following objects are masked from 'package:foreign':

    read.dbf, write.dbf

Note: Function plotsurf depends on akima which has
 a restricted licence that explicitly forbids commercial use.
 akima is therefore disabled by default and may be enabled by
 akimaPermit(). Calling this function includes your agreement to
 akima`s licence restrictions.
   A  B  C  D  E  F
A  1 -1  0  0  0  0
B -1  2 -1  0  0  0
C  0 -1  1  0  0  0
D  0  0  0  1  0 -1
E  0  0  0  0  1 -1
F  0  0  0 -1 -1  2
attr(,"class")
[1] "gra"

BayesX documentation built on Aug. 24, 2019, 9:03 a.m.