title: Indicator Vector based on two Character vectors' common element
body: <p>I have a character vector:</p>
  
  <pre><code>beta = c("V1","V2","V3","V4","V5")
  </code></pre>
  
  <p>and another character vector:</p>
  
  <pre><code>beta1 = c("V1","V3")
  </code></pre>
  
  <p>Now I want to create a num vector <code>alpha</code> of length 5 in the following way: if <code>"V_{i}"</code> is present in <code>beta1</code> then i-th index at vector <code>alpha</code> will take value <code>1</code>. Else the i-th index value will be <code>0</code>.</p>
  
  <p>For example, in the above case, <code>alpha</code> is <code>c(1,0,1,0,0)</code> because "V1" and "V3" are present in <code>beta1</code></p>
  
  <p>If <code>beta1</code> was <code>c("V4","V5")</code> then <code>alpha</code> would be <code>c(0,0,0,1,1)</code></p>
  
  <p>How can I do this in R in an efficient way?</p>