title: Cross Referencing Dataframe in R
body: <p>I have the following data frame:</p>
  <pre><code>df=data.frame(1:5, c(2,4,8,16,11), c(4,11,4,11,8))
  colnames(df)=c(&quot;a&quot;,&quot;b&quot;,&quot;c&quot;)
  df
    a  b  c
  1 1  2  4
  2 2  4 11
  3 3  8  4
  4 4 16 11
  5 5 11  8
  </code></pre>
  <p>I would like to match <em>every</em> instance of df$a where the values in df$c are in relation to their match in df$b. My desired output would be some kind of list probably, something like</p>
  <pre><code>[[1]]
  [1] NA
  
  [[2]]
  [1] 1,3
  
  [[3]]
  [1] 5
  
  [[4]]
  [1] NA
  
  [[5]]
  [1] 2,4
  </code></pre>
  <p>Any suggestions? I know the match function but that only returns the first match.</p>