代码片段:
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"
为什么是 blarg$bc(1, "ZZZ", 3)?数字从何而来?