Clustering by minimum distance : I want to clustering my data by minimum distance between known centers.
How to implement using R?

the centers data

    > centers
       X
    1   -0.78998176
    2    2.40331380
    3    0.77320007
    4   -1.64054294
    5   -0.05343331
    6   -1.14982180
    7    1.67658736
    8   -0.44575567
    9    0.36314671
    10   1.18697840

the data wanted to be clustered

    > Y
    [1] -0.7071068  0.7071068 -0.3011463 -0.9128686 -0.5713978   NA

the result I expected:

    1. find the closest distance (minimum absolute difference value) between each 
       items in Y and centers.
    2. Assigns sequence number of centers to each items in Y

expected result:
 

    > Y
        [1] 1 3 8 6 1  NA


    Y <- c(-0.707106781186548, 0.707106781186548, -0.301146296962689, 
    -0.912868615826101, -0.571397763410073, NA)
    
    centers <- structure(c(-0.789981758587318, 2.40331380121291, 0.773200070034431, 
    -1.64054294268215, -0.0534333085941505, -1.14982180092619, 1.67658736336158, 
    -0.445755672120908, 0.363146708827924, 1.18697840480949), .Dim = c(10L, 
    1L), .Dimnames = list(c("1", "2", "3", "4", "5", "6", "7", "8", 
    "9", "10"), "X"))




