Description Usage Arguments Details Value Warning Author(s) See Also Examples
This function creates an object of class nb
(defined in the library spdep) containing a connexion diagram. The edges between sites are based on a tolerance angle and a maximum distance. The angle is directional; its direction is always from the bottow to the top of the screen.
1 2 | tolerance.nb(coords, unit.angle = "degrees", max.dist, tolerance, rot.angle,
plot.sites=FALSE)
|
coords |
A matrix or a data frame containing the X and Y coordinates of the study sites. |
unit.angle |
Character. The measurement units in which angles are defined: either "degrees" (default) or "radians". |
max.dist |
Numeric. The maximum distance of an edge linking two sites together. |
tolerance |
Numeric. The tolerance angle in which a site can influence another site. The angle is measured vertically and from bottom to top of the pictures after rotation of the points. |
rot.angle |
Numeric, optional. An angle at which a set of coordinates should be rotated before creating the connexion diagram. The set of coordinates is rotated counterclockwise. Negative values will produce a clockwise rotation. |
plot.sites |
Logical ( |
Even though this function creates a connexion diagram based on a tolerance angle going from the bottom to the top of the screen, the resulting object is symmetric, meaning that a site influences another and vice versa. The final object does not represent a directional connexion network.
The function returns an object of class nb
with a list of integer vectors corresponding to neighbour region numbers.
This function was not design to handle a large number of rows in coords
.
To use this function for a set of coordinates with more than 1500 entries is memory intensive.
F. Guillaume Blanchet
dnearneigh
, cell2nb
, graph2nb
, tri2nb
, knn2nb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | set.seed(1)
ex.data<-cbind(runif(50),rexp(50))
### Construct object of class nb with a tolerance angle of 30 degrees
### and a maximum distance of 2 m.
nb.ex<-tolerance.nb(ex.data, unit.angle = "degrees", max.dist=1,
tolerance = 30)
### Construct object of class nb with a tolerance angle of 30 degrees
### and a maximum distance of 2 m. The coordinates are rotated at an angle
### of 45 degrees counterclockwise.
nb.ex2<-tolerance.nb(ex.data, unit.angle = "degrees", max.dist=1,
tolerance = 30, rot.angle = 45)
### Construct object of class nb with a tolerance angle of pi/8 radians
### and a maximum distance of 1.5 m. The coordinates are rotated at
### an angle of pi/4 radians clockwise.
nb.ex3<-tolerance.nb(ex.data, unit.angle = "radians", max.dist=1.5,
tolerance = pi/8, rot.angle = -pi*2/3)
par(mfrow=c(1,3))
plot(nb.ex,ex.data,asp=1)
plot(nb.ex2,ex.data,asp=1)
plot(nb.ex3,ex.data,asp=1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.