title: How to retrieve multiple matching elements?
body: <p>I have to two data frames <code>df_a</code>, <code>df_b</code>.</p>
  <pre><code>set.seed(143)
  df_a &lt;- data.frame(colA = sample(1:10, 10, replace=T), colB = sample(LETTERS[1:20],10))
  df_a
  #   colA colB
  #1    10    I
  #2     1    D
  #3     8    R
  #4     5    F
  #5     1    N
  #6    10    P
  #7     7    E
  #8     6    S
  #9     6    T
  #10    4    C
  
  df_b &lt;- data.frame(colA = sample(1:10, 10, replace=T))
  df_b
  #   colA
  #1     9
  #2     3
  #3     9
  #4     9
  #5     3
  #6    10
  #7    10
  #8     7
  #9     4
  #10    7
  </code></pre>
  <p>I have to update the <code>colB</code> with values from <code>colB</code> in data frame <code>df_a</code> based on the matching of the <code>colA</code> in both data frames.</p>
  <pre><code>df_a[match(df_b$colA, df_a$colA),'colB']
  # [1] &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; I    I    E    C    E   
  #Levels: C D E F I N P R S T
  </code></pre>
  <p>The output doesn't give more than one matched element(not a surprise!). For eg., <code>10</code> has two values <code>I</code>,<code>P</code> but only gives <code>I</code>.</p>
  <pre><code>Expected Output(something like this, maybe?):
  
  df_a[match(df_b$colA, df_a$colA),'colB']
  # [1] &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; &lt;NA&gt; I,P    I,P   E    C    E   
  #Levels: C D E F I N P R S T
  </code></pre>
  <p>As the <a href="https://stackoverflow.com/questions/36576347/matching-and-update-a-column-of-a-dataframe-based-on-another-dataframe#comment60751749_36576347"><code>match()</code></a> function returns only the first matched value, is there any other alternative like <code>which()</code> or <code>%in%</code> for achieving the task ?</p>