title: PAM Clustering - Use the results in another data-set
body: <p>I've successfully run a Partitioning Around Medoids using the <em>pam</em> function (cluster package in R) and now, I would like to use the results to attribute new observations to the previously defined clusters/medoids. </p>
  
  <p>Another way to put the problem is, given the <em>k</em> clusters/medoids that have been found by the <em>pam</em> function, which is closer to an additional observation that was not in the initial dataset?</p>
  
  <pre><code>x&lt;-matrix(c(1,1.2,0.9,2.3,2,1.8,
              3.2,4,3.1,3.9,3,4.4),6,2)
  x
       [,1] [,2]
  [1,]  1.0  3.2
  [2,]  1.2  4.0
  [3,]  0.9  3.1
  [4,]  2.3  3.9
  [5,]  2.0  3.0
  [6,]  1.8  4.4
  pam(x,2)
  </code></pre>
  
  <p>Observations 1, 3 and 5, and 2, 4 and 6 are clustered together and observations 1 and 6 are the medoids:</p>
  
  <pre><code>Medoids:
       ID        
  [1,]  1 1.0 3.2
  [2,]  6 1.8 4.4
  Clustering vector:
  [1] 1 2 1 2 1 2
  </code></pre>
  
  <p>Now, to which cluster/medoid y should be attributed/associated with?</p>
  
  <pre><code>y&lt;-c(1.5,4.5)
  </code></pre>
  
  <p>Oh, and in case you have several solutions, computing time matters in the big data-set I have.</p>