title: which column is a duplicate column a duplicate of?
body: <p>I have a data frame with possibly several duplicated columns.
  I would like to do 2 thing (the following is a reproducible example, in practice I have dozens of columns):</p>
  
  <p>First, Extract the unique columns. This can efficiently be accomplished with the following command:</p>
  
  <pre><code>library(dplyr)
  df = data_frame(x = rnorm(100), y = rnorm(100), z = y, w = x)
  df[!duplicated(as.list(df))]
  </code></pre>
  
  <p>This outputs columns <code>x</code> and <code>y</code>.</p>
  
  <p>Next, I would like to find specifically which is the duplicate of <code>x</code> (<code>w</code>) and which is the duplicate of <code>y</code> (<code>z</code>). How can I do this efficiently?</p>