title: matching and mutate from another data set in R
body: <p>Say I have 2 data set one, data_a is my main data set and I want to create a new column in data_a call success based on data_b, I was thinking to use ifelse statement to match the data if it both appears in data_a and data_b then if return 1 if not 0/</p>
  <p>Data set and code:</p>
  <pre><code>name &lt;- c(&quot;A&quot;,&quot;B&quot;,&quot;c&quot;,&quot;D&quot;,&quot;E&quot;,&quot;A&quot;)
  name_b &lt;-c(&quot;A&quot;,&quot;B&quot;,&quot;c&quot;)
  
  
  data_a &lt;- data.frame(name)
  data_b &lt;- data.frame(name_b)
  
  </code></pre>
  <p>My code to try:</p>
  <pre><code>data_a$success&lt;- ifelse(data_b$name_b == data_a$name, 1,0)
  
  </code></pre>
  <p>Desire Output from data_a</p>
  <pre><code>name success
  A     1
  B     1
  C     1
  D     0
  E     0
  A     1
  
  </code></pre>
  <p>Any idea to make it work? Thanks</p>