title: Left join with multiple conditions in R
body: <p>I'm trying to replace ids for their respective values. The problem is that each id has a different value according to the previous column <code>type</code>, like this:</p>
  
  <pre><code>&gt;df
    type id 
  1  q1   1
  2  q1   2
  3  q2   1
  4  q2   3
  5  q3   1
  6  q3   2
  </code></pre>
  
  <p>Here's the type ids with its value:</p>
  
  <pre><code>&gt;q1
    id value
  1 1  yes
  2 2  no
  
  &gt;q2 
     id value
  1  1  one hour
  2  2  two hours
  3  3  more than two hours
  
  &gt;q3
    id value
  1 1  blue
  2 2  yellow
  </code></pre>
  
  <p>I've tried something like this:</p>
  
  <pre><code>df &lt;- left_join(subset(df, type %in% c("q1"), q1, by = "id"))
  </code></pre>
  
  <p>But it removes the other values.</p>
  
  <p>I' like to know how to do a <code>one liner solution</code> (or kind of) because there are more than 20 vectors with types description.</p>
  
  <p>Any ideias on how to do it?</p>
  
  <p>This is the df i'm expecting:</p>
  
  <pre><code>&gt;df
    type id value
  1  q1   1 yes
  2  q1   2 no
  3  q2   1 one hour
  4  q2   3 more than two hours
  5  q3   1 blue
  6  q3   2 yellow
  </code></pre>