title: if else in r using %in%
body: <p>Let us assume that my first dataset is iris</p>
  
  <pre><code> data(iris)
   head(iris)
  
     Sepal.Length Sepal.Width Petal.Length Petal.Width Species
     5.1         3.5          1.4         0.2  setosa
     4.9         3.0          1.4         0.2  setosa
     4.7         3.2          1.3         0.2  setosa
     4.6         3.1          1.5         0.2  setosa
     5.0         3.6          1.4         0.2  setosa
     5.4         3.9          1.7         0.4  setosa
  </code></pre>
  
  <p>My second dataset contains a column type as shown below</p>
  
  <pre><code>   type
     setosa
     veranica
     Big Rosa
     virginica
  </code></pre>
  
  <p>I am trying to generate a sixth column in iris dataset with values Yes and No, Yes if values in iris$Species == 2ndDataset$type else no.</p>
  
  <p>I am interested in doing this using %in% option. I tried but failed, this is what I did so far</p>
  
  <pre><code>  iris[(as.character(iris$Species ) %in% as.character(2ndDataset$type)) ,  Result = 1, Result = 0]
  </code></pre>
  
  <p>Need help.</p>