A deterministic clustering device of vector elements into k clusters

dcluspar(k, vec)

Arguments

k

number of clusters

vec

the vector of real valued elements

Value

clus integer assignment of corresponding elements in vec in up to k clusters

Examples

set.seed(2); (v=c(rnorm(4,0,0.5),rnorm(3,3,0.5))[sample(1:7)])
#> [1] 0.79392267 3.06621014 2.95987412 -0.44845727 0.09242459 -0.56518784 #> [7] 3.35397736
dcluspar(k=2,vec = v)
#> [1] 1 2 2 1 1 1 2