title: Remove perfectly multicollinear variables from data frame
body: <p>I have a data frame with variables, of which some contain the same information</p>
  
  <pre><code>x1 = runif(1000)
  x2 = runif(1000)
  x3 = x1 + x2
  x4 = runif(1000)
  x5 = runif(1000)*0.00000001 +x4
  x6 = x5 + x3
  x = data.frame(x1, x2, x3, x4, x5, x6)
  </code></pre>
  
  <p>In a next step I want to rid myself of all variables which are perfectly multicollinear, e.g. column x3 and x6 (there might be also other combinations).</p>
  
  <p>In Stata this is fairly easy:  <code>_rmcoll varlist</code></p>
  
  <p>How is this efficiently done in R?</p>
  
  <p>EDIT:
  Note that the ultimate goal is to compute the Mahalanobis distance between observations. For this I need to drop redunant variables. And as far as I can foresee, for this application it would not matter whether I drop x1, x2 or x3</p>