ifelse
Others have commented on why this holds. There is an alternative, 'ifelse1', part of the splus2R package, that does what you'd like here. Tim Hesterberg
I find it slightly surprising, that ifelse(TRUE, character(0), "") returns NA instead of character(0). -- Heikki Kaskelma