title: How to calculate the distance between a test object and all training objects
body: <p>How to calculate the distance between a test object and all training objects. </p>
  
  <p>Then, repeating this with other test objects and store them automatically. </p>
  
  <p>The code I use for only one row of test set.</p>
  
  <pre><code>n &lt;- matrix( )
    for (i in 1:nrow(wdbc_train)) {
        n[i]&lt;-sum(abs(wdbc_train[i,]-wdbc_test[1,])^2)
    }
  </code></pre>