title: Create a new column which looks-up values in other columns
body: <p>I have the following data:</p>
  
  <pre><code>df &lt;- data.frame(a=c(0,0,0,1,1,1),
                   b=c(1,2,3,1,2,3), 
                   c=c("a","b","c","x","y","z"),
                   stringsAsFactors = FALSE) 
  
  df
  
  #&gt;   a b c
  #&gt; 1 0 1 a
  #&gt; 2 0 2 b
  #&gt; 3 0 3 c
  #&gt; 4 1 1 x
  #&gt; 5 1 2 y
  #&gt; 6 1 3 z
  </code></pre>
  
  <p>I'd like to create a 4th column, "d" which returns the value from "c" where "a" = 0 and b=b, like so:</p>
  
  <pre><code>#&gt;   a b c d
  #&gt; 1 0 1 a a
  #&gt; 2 0 2 b b
  #&gt; 3 0 3 c c
  #&gt; 4 1 1 x a
  #&gt; 5 1 2 y b
  #&gt; 6 1 3 z c
  </code></pre>
  
  <p>I've tried:</p>
  
  <pre><code>df %&gt;% mutate(d = c[a==0 &amp; b==b])
  </code></pre>
  
  <p>But this doesn't work.</p>
  
  <p>How can I create column "d" using dplyr?</p>