Description Usage Arguments Value Author(s) Examples
View source: R/spatial_clusters.R
This function identifies spatial clusters from spatial coordinates (longitude
/ latitude) using Kmeans clustering. The resulting object is a
spatial_clusters
object which can be plotted with several options.
1 2 3 4 5 6 7 8 9 10 11 | spatial_clusters(x, k)
## S3 method for class 'spatial_clusters'
print(x, ...)
## S3 method for class 'spatial_clusters'
plot(x, show_clusters = TRUE,
show_points = FALSE, show_tiles = FALSE, show_density = FALSE,
pt_col = "red", pt_alpha = 0.3, cl_col = "red", cl_alpha = 0.7,
dens_alpha = 0.3, dens_bw = 0.005, leg_posi = c(0.1, 0.8), zoom = 13,
...)
|
x |
A |
k |
An |
show_clusters |
A logical indicating if clusters should be plotted. |
show_points |
A logical indicating if individual points should be plotted. |
show_tiles |
A logical indicating if Voronoi tesselation should be plotted. |
show_density |
A logical indicating if case density should be plotted. |
pt_col |
The color to be used for individual points. |
pt_alpha |
The transparency level to be used for individual points. |
cl_col |
The color to be used for clusters. |
cl_alpha |
The transparency level to be used for clusters. |
dens_alpha |
The transparency level to be used for case density. |
dens_bw |
The bandwidth to be used for case density estimation; larger values correspond to a wider kernel. |
leg_posi |
The (x,y) position of the legend, on a relative scale from 0 to 1. |
zoom |
The zoom level to be used for |
x |
A |
The function returns a spatial_cluster
object, which is a list with
the following items:
lonlat
: a matrix of lon/lat for individual points
clusters_coords
: a matrix of lon/lat/size for clusters
clusters
: cluster membership for the point locations
voronoi
: voronoi tesselation for the clusters
Thibaut Jombart (thibautjombart@gmail.com)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.