[R] inconsistent behaviour of ifelse and if ... else

Joerg van den Hoff j.van_den_Hoff at fz-rossendorf.de
Wed Dec 21 14:53:39 CET 2005

is the behaviour

val <- ifelse(TRUE, numeric(0), 123)
val  #NA

intended or is it a bug, i.e. should an empty object be returned as 
might be expected(also in comparsion to what an explicit
val <- {if(TRUE) numeric(0) else 123} yields)?



More information about the R-help mailing list