Assigns data points to k clusters

assign(X, centers)

Arguments

X

array Data points of dimension (n,d)

centers

array Coordinates of cluster centers, dimension (k,d)

Value

array Cluster assignments for each point in X, dimension (n,1)

Examples

X = rbind(c(0,0), c(1,1)) centers = rbind(c(0.1, 0.1), c(1.1, 1.1)) assign(X, centers)
#> [,1] #> [1,] 1 #> [2,] 2