title: How to efficiently extract a row or column from a "dist" distance matrix
body: <p>I'm working with a 39000+ data points and I'm computing the distance between a point and every single other one of them, resulting in a (39000+)^2 matrix that consumes 11GB (and I can't allocate this in the memory).</p>
  
  <p>Great thing we have the <code>dist</code> function that allows me to reduce this to a little bit less than 6GB. But now, I need to calculate the inverse distances powered by 2 and then regularize every row so that they sum up to 1. This is necessary because I will later multiply every row of the matrix by a vector and store this result. So, the big matrix is actually a temporary thing.</p>
  
  <p>My question is, how can I extract rows of this <code>dist</code> matrix?</p>
  
  <p>A sample "dist" matrix obtained with <code>dist(cbind(runif(5),runif(5))</code></p>
  
  <pre><code>       1    2    3    4    
  2   0.47                                                                                                                                  
  3   0.63 0.72                                                                                                                             
  4   0.79 0.62 0.37                                                                                                                        
  5   0.53 0.15 0.62 0.48                                                                                                                   
  
  
  </code></pre>
  
  <p>What I'm looking for is to extract the entire first line, for instance:</p>
  
  <pre><code>0  0.47  0.63  0.79  0.53
  </code></pre>