title: How does R's ifelse work with character data?
body: <p>A code fragment:</p>
  
  <pre><code>blarg = data.frame(a=c("aa", "bb", "dd"))
  blarg$b = blarg$a
  # blarg$b is now c("aa", "bb", "dd")
  blarg$b = ifelse(blarg$a!="bb",blarg$a,"ZZZ")
  # blarg$b is now c(1, "ZZZ", 3)
  # I expected c("aa", "ZZZ", "dd")
  # typeof(blarg$b) is "character"
  </code></pre>
  
  <p>Why is blarg$b c(1, "ZZZ", 3)? Where do the numbers come from?</p>