exClusterByKruskal: Function of Kruskal Clustering with Spatial Distances

Description Usage Arguments Value Author(s) References Examples

Description

This function is implementation of Kruskal Clustering for input of spatial distances.

Usage

1
2
exClusterByKruskal(spcoords, mininterClusterDist = 8000,
  dist_scalor = 1000)

Arguments

spcoords

Data frame with the columns of x and y coordinates.

mininterClusterDist

Minimum intercluster distance used in Kruskal clustering.

dist_scalor

Scaling factor for the coordinates to avoid overflow by using too big integers.

Value

A list: (clusterid,clsCenter,sumCls,withinss,tot.withinss)

clusterid

Cluster id for every row of the input data

clsCenter

Central coordinates for each the cluster

sumCls

Frequency summary for each cluster

withinss

Vector of within-cluster sum of squares, one component per cluster.

tot.withinss

Total within-cluster sum of squares, i.e. sum(withinss)

Author(s)

Lianfa Li lspatial@gmail.com

References

Kruskal, J. B. (1956). On the shortest spanning subtree of a graph and the traveling salesman problem. Proceedings of the American Mathematical Society. 7: 48–50. doi:10.1090/S0002-9939-1956-0078686-7. JSTOR 2033241.

Examples

1
2
3
4
5
6
  x1=rnorm(500, mean=10, sd=2)
  x2=rnorm(500,mean=20,sd=5)
  y1=rnorm(500, mean=400, sd=2)
  y2=rnorm(500,mean=200,sd=5)
  samples=data.frame(x=c(x1,x2),y=c(y1,y2))
  krClusterRes=exClusterByKruskal(samples,mininterClusterDist=100,dist_scalor =1)

sptemExp documentation built on July 7, 2019, 9:02 a.m.