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

From: Joerg van den Hoff <j.van_den_Hoff_at_fz-rossendorf.de>
Date: Thu 22 Dec 2005 - 00:53:39 EST


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)?

thanks,

joerg



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Dec 22 00:59:31 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:40 EST