Skip to content
Prev 78618 / 398502 Next

Warning: condition has length > 1

On Sat, 8 Oct 2005, nawaf b wrote:

            
+ ifelse(x>=1, 0, x^2)
[1] 0.09 0.00 0.49 0.00

ifelse() is vectorised, but if() only looks at the first element in x 
before deciding what to do - so if the condition is longer, the rest gets 
ignored.