title: ifelse and %in% applied to rows of a dataframe in R
body: <p>Excuse my simple question, but since ifelse is vectorized, shouldn't it iterate through the rows of my dataframe?</p>
  
  <p>e.g, when I try</p>
  
  <pre><code>   df &lt;- data.frame(col1=c("a", "b", "c"),
                      col2=c("d", "e", "f"), 
                      col3=c("g", "h", "i"), stringsAsFactors=FALSE)
  
      ifelse('a' %in% df, 1, 0)
  </code></pre>
  
  <p>My result is 0.</p>
  
  <p>Shouldn't it be 1, 0, 0?</p>
  
  <p>In this case, what's the point of <code>ifelse</code>? Can I somehow use this function to iterate through my dataframe?</p>